diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte
index 787ee882a..38332fb0e 100644
--- a/src/lib/components/chat/ModelSelector/Selector.svelte
+++ b/src/lib/components/chat/ModelSelector/Selector.svelte
@@ -42,6 +42,7 @@
}[] = [];
export let className = 'w-[32rem]';
+ export let triggerClassName = 'text-lg';
let show = false;
@@ -236,7 +237,7 @@
id="model-selector-{id}-button"
>
{#if selectedModel}
{selectedModel.label}
diff --git a/src/lib/components/common/Collapsible.svelte b/src/lib/components/common/Collapsible.svelte
index e514d92a6..b61e74dd5 100644
--- a/src/lib/components/common/Collapsible.svelte
+++ b/src/lib/components/common/Collapsible.svelte
@@ -15,6 +15,8 @@
export let buttonClassName = 'w-fit';
export let title = null;
+ export let grow = false;
+
export let disabled = false;
export let hide = false;
@@ -60,13 +62,28 @@
>
+
+ {#if grow}
+ {#if open && !hide}
+
{
+ e.stopPropagation();
+ }}
+ >
+
+
+ {/if}
+ {/if}
{/if}
- {#if open && !hide}
-
-
-
+ {#if !grow}
+ {#if open && !hide}
+
+
+
+ {/if}
{/if}
diff --git a/src/lib/components/common/Sidebar.svelte b/src/lib/components/common/Sidebar.svelte
new file mode 100644
index 000000000..4ff3d2a6b
--- /dev/null
+++ b/src/lib/components/common/Sidebar.svelte
@@ -0,0 +1,30 @@
+
+
+{#if show}
+
+ {
+ show = false;
+ }}
+ transition:fade
+ />
+
+
+{/if}
diff --git a/src/lib/components/icons/ArrowRight.svelte b/src/lib/components/icons/ArrowRight.svelte
new file mode 100644
index 000000000..a3ac1af4b
--- /dev/null
+++ b/src/lib/components/icons/ArrowRight.svelte
@@ -0,0 +1,15 @@
+
+
+
diff --git a/src/lib/components/icons/Cog6.svelte b/src/lib/components/icons/Cog6.svelte
new file mode 100644
index 000000000..286b62624
--- /dev/null
+++ b/src/lib/components/icons/Cog6.svelte
@@ -0,0 +1,20 @@
+
+
+
diff --git a/src/lib/components/icons/PencilSquare.svelte b/src/lib/components/icons/PencilSquare.svelte
new file mode 100644
index 000000000..9d44ac64b
--- /dev/null
+++ b/src/lib/components/icons/PencilSquare.svelte
@@ -0,0 +1,13 @@
+
+
+
diff --git a/src/lib/components/playground/Chat.svelte b/src/lib/components/playground/Chat.svelte
index 4abcdca26..eb06a9df2 100644
--- a/src/lib/components/playground/Chat.svelte
+++ b/src/lib/components/playground/Chat.svelte
@@ -10,13 +10,21 @@
WEBUI_API_BASE_URL,
WEBUI_BASE_URL
} from '$lib/constants';
- import { WEBUI_NAME, config, user, models, settings, showSidebar } from '$lib/stores';
+ import { WEBUI_NAME, config, user, models, settings } from '$lib/stores';
import { generateOpenAIChatCompletion } from '$lib/apis/openai';
import { splitStream } from '$lib/utils';
- import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte';
import Selector from '$lib/components/chat/ModelSelector/Selector.svelte';
+ import Collapsible from '../common/Collapsible.svelte';
+
+ import Messages from './chat/Messages.svelte';
+ import ChevronUp from '../icons/ChevronUp.svelte';
+ import ChevronDown from '../icons/ChevronDown.svelte';
+ import Pencil from '../icons/Pencil.svelte';
+ import Cog6 from '../icons/Cog6.svelte';
+ import Sidebar from '../common/Sidebar.svelte';
+ import ArrowRight from '../icons/ArrowRight.svelte';
const i18n = getContext('i18n');
@@ -28,13 +36,15 @@
let messagesContainerElement: HTMLDivElement;
+ let showSystem = false;
+ let showSettings = false;
+
let system = '';
- let messages = [
- {
- role: 'user',
- content: ''
- }
- ];
+
+ let role = 'user';
+ let message = '';
+
+ let messages = [];
const scrollToBottom = () => {
const element = messagesContainerElement;
@@ -137,6 +147,20 @@
}
};
+ const addHandler = async () => {
+ if (message) {
+ messages.push({
+ role: role,
+ content: message
+ });
+ messages = messages;
+ message = '';
+ role = role === 'user' ? 'assistant' : 'user';
+ await tick();
+ scrollToBottom();
+ }
+ };
+
const submitHandler = async () => {
if (selectedModelId) {
loading = true;
@@ -164,40 +188,95 @@
-
-
-
-
-
-
-
- ({
- value: model.id,
- label: model.name,
- model: model
- }))}
- bind:value={selectedModelId}
- />
-
+
+
+
+
+
+
+
+
Model
+
+
+ ({
+ value: model.id,
+ label: model.name,
+ model: model
+ }))}
+ bind:value={selectedModelId}
+ />
+
-
-
-
{$i18n.t('System')}
-
+
+
+
+
+
+ {$i18n.t('System Instructions')}
+
+
+ {#if !showSystem}
+
+ {system}
+
+ {/if}
+
+
+
+
+
+
+
+
+
+
+
+
-
- {#if !loading}
-
- {:else}
-
- {/if}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {#if !loading}
+
+
+
+ {:else}
+
+ {/if}
+
+
+
-
-
diff --git a/src/lib/components/playground/ChatCompletion.svelte b/src/lib/components/playground/Chat/Messages.svelte
similarity index 76%
rename from src/lib/components/playground/ChatCompletion.svelte
rename to src/lib/components/playground/Chat/Messages.svelte
index 25cc99ec4..4fd4e212e 100644
--- a/src/lib/components/playground/ChatCompletion.svelte
+++ b/src/lib/components/playground/Chat/Messages.svelte
@@ -74,38 +74,5 @@
-
-
{/each}
-
-
diff --git a/src/lib/components/playground/Completions.svelte b/src/lib/components/playground/Completions.svelte
index f370a2e0c..abc3b8db1 100644
--- a/src/lib/components/playground/Completions.svelte
+++ b/src/lib/components/playground/Completions.svelte
@@ -6,12 +6,9 @@
import { WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_NAME, config, user, models, settings, showSidebar } from '$lib/stores';
-
- import { generateChatCompletion } from '$lib/apis/ollama';
import { generateOpenAIChatCompletion } from '$lib/apis/openai';
import { splitStream } from '$lib/utils';
- import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte';
import Selector from '$lib/components/chat/ModelSelector/Selector.svelte';
import MenuLines from '../icons/MenuLines.svelte';
@@ -125,7 +122,7 @@
-
+
@@ -147,15 +144,15 @@
-
+
@@ -171,7 +168,7 @@
submitHandler();
}}
>
- {$i18n.t('Submit')}
+ {$i18n.t('Run')}
{:else}
-