Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
5196b65c
Commit
5196b65c
authored
Jun 06, 2024
by
Timothy J. Baek
Browse files
feat: call ui scaffold
parent
340b716a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
3 deletions
+93
-3
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+10
-2
src/lib/components/chat/MessageInput/CallOverlay.svelte
src/lib/components/chat/MessageInput/CallOverlay.svelte
+75
-0
src/lib/stores/index.ts
src/lib/stores/index.ts
+1
-0
src/routes/(app)/+layout.svelte
src/routes/(app)/+layout.svelte
+7
-1
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
5196b65c
<script lang="ts">
<script lang="ts">
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import { onMount, tick, getContext } from 'svelte';
import { onMount, tick, getContext } from 'svelte';
import { type Model, mobile, settings, showSidebar, models, config } from '$lib/stores';
import {
type Model,
mobile,
settings,
showSidebar,
models,
config,
showCallOverlay
} from '$lib/stores';
import { blobToFile, calculateSHA256, findWordIndices } from '$lib/utils';
import { blobToFile, calculateSHA256, findWordIndices } from '$lib/utils';
import {
import {
...
@@ -889,7 +897,7 @@
...
@@ -889,7 +897,7 @@
class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-2 self-center"
class=" text-gray-600 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-850 transition rounded-full p-2 self-center"
type="button"
type="button"
on:click={() => {
on:click={() => {
console.log('call'
);
showCallOverlay.set(true
);
}}
}}
>
>
<Headphone className="size-6" />
<Headphone className="size-6" />
...
...
src/lib/components/chat/MessageInput/CallOverlay.svelte
0 → 100644
View file @
5196b65c
<script lang="ts">
import { showCallOverlay } from '$lib/stores';
import { onMount, tick, getContext } from 'svelte';
const i18n = getContext('i18n');
onMount(async () => {
console.log('wip');
});
</script>
<div class=" absolute w-full h-full flex z-[999]">
<div
class="absolute w-full h-full bg-white text-gray-700 dark:bg-black dark:text-gray-300 flex justify-center"
>
<div class="max-w-md w-full h-screen flex flex-col justify-between p-6">
<div>
<!-- navbar -->
</div>
<div class="flex justify-center items-center w-ull">
<div class=" size-44 bg-black dark:bg-white rounded-full animate-pulse" />
</div>
<div class="flex justify-between items-center pb-2 w-full">
<div>
<button class=" p-3 rounded-full bg-gray-50 dark:bg-gray-900">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="size-5"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M6.827 6.175A2.31 2.31 0 0 1 5.186 7.23c-.38.054-.757.112-1.134.175C2.999 7.58 2.25 8.507 2.25 9.574V18a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9.574c0-1.067-.75-1.994-1.802-2.169a47.865 47.865 0 0 0-1.134-.175 2.31 2.31 0 0 1-1.64-1.055l-.822-1.316a2.192 2.192 0 0 0-1.736-1.039 48.774 48.774 0 0 0-5.232 0 2.192 2.192 0 0 0-1.736 1.039l-.821 1.316Z"
/>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M16.5 12.75a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0ZM18.75 10.5h.008v.008h-.008V10.5Z"
/>
</svg>
</button>
</div>
<div class=" line-clamp-1 text-sm font-medium">Listening...</div>
<div>
<button
class=" p-3 rounded-full bg-gray-50 dark:bg-gray-900"
on:click={async () => {
showCallOverlay.set(false);
}}
type="button"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="size-5"
>
<path
d="M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"
/>
</svg>
</button>
</div>
</div>
</div>
</div>
</div>
src/lib/stores/index.ts
View file @
5196b65c
...
@@ -50,6 +50,7 @@ export const showSidebar = writable(false);
...
@@ -50,6 +50,7 @@ export const showSidebar = writable(false);
export
const
showSettings
=
writable
(
false
);
export
const
showSettings
=
writable
(
false
);
export
const
showArchivedChats
=
writable
(
false
);
export
const
showArchivedChats
=
writable
(
false
);
export
const
showChangelog
=
writable
(
false
);
export
const
showChangelog
=
writable
(
false
);
export
const
showCallOverlay
=
writable
(
false
);
export
type
Model
=
OpenAIModel
|
OllamaModel
;
export
type
Model
=
OpenAIModel
|
OllamaModel
;
...
...
src/routes/(app)/+layout.svelte
View file @
5196b65c
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
tags,
tags,
banners,
banners,
showChangelog,
showChangelog,
config
config,
showCallOverlay
} from '$lib/stores';
} from '$lib/stores';
import { REQUIRED_OLLAMA_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { REQUIRED_OLLAMA_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { compareVersion } from '$lib/utils';
import { compareVersion } from '$lib/utils';
...
@@ -39,6 +40,7 @@
...
@@ -39,6 +40,7 @@
import Help from '$lib/components/layout/Help.svelte';
import Help from '$lib/components/layout/Help.svelte';
import AccountPending from '$lib/components/layout/Overlay/AccountPending.svelte';
import AccountPending from '$lib/components/layout/Overlay/AccountPending.svelte';
import { error } from '@sveltejs/kit';
import { error } from '@sveltejs/kit';
import CallOverlay from '$lib/components/chat/MessageInput/CallOverlay.svelte';
const i18n = getContext('i18n');
const i18n = getContext('i18n');
...
@@ -190,6 +192,10 @@
...
@@ -190,6 +192,10 @@
class=" text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900 h-screen max-h-[100dvh] overflow-auto flex flex-row"
class=" text-gray-700 dark:text-gray-100 bg-white dark:bg-gray-900 h-screen max-h-[100dvh] overflow-auto flex flex-row"
>
>
{#if loaded}
{#if loaded}
{#if $showCallOverlay}
<CallOverlay />
{/if}
{#if !['user', 'admin'].includes($user.role)}
{#if !['user', 'admin'].includes($user.role)}
<AccountPending />
<AccountPending />
{:else if localDBChats.length > 0}
{:else if localDBChats.length > 0}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment