diff --git a/src/routes/(app)/playground/+page.svelte b/src/routes/(app)/playground/+page.svelte
index cf6f87c3f..e01012200 100644
--- a/src/routes/(app)/playground/+page.svelte
+++ b/src/routes/(app)/playground/+page.svelte
@@ -6,12 +6,12 @@
import { toast } from 'svelte-sonner';
import { WEBUI_API_BASE_URL } from '$lib/constants';
- import { WEBUI_NAME, config, user, models } from '$lib/stores';
+ import { WEBUI_NAME, config, user, models, settings } from '$lib/stores';
import { cancelChatCompletion, generateChatCompletion } from '$lib/apis/ollama';
import { splitStream } from '$lib/utils';
- let mode = 'complete';
+ let mode = 'chat';
let loaded = false;
let text = '';
@@ -22,6 +22,9 @@
let currentRequestId;
let stopResponseFlag = false;
+ let system = '';
+ let messages = [];
+
const scrollToBottom = () => {
const element = document.getElementById('text-completion-textarea');
element.scrollTop = element.scrollHeight;
@@ -114,6 +117,13 @@
await goto('/');
}
+ if ($settings?.models) {
+ selectedModel = $settings?.models[0];
+ } else if ($config?.default_models) {
+ selectedModel = $config?.default_models.split(',')[0];
+ } else {
+ selectedModel = '';
+ }
loaded = true;
});
@@ -128,14 +138,16 @@
-
-
-
Playground
+
+
+
+ Playground (Beta)
+
+ {#if mode === 'complete'}
+ Text Completion
+ {:else if mode === 'chat'}
+ Chat
+ {/if}
+
+
+
-
+
-
+ -->
-
-
-
+ {#if mode === 'chat'}
+
+ {/if}
-
- {#if !loading}
-
- {:else}
-
- {/if}
+
+
+
+ {#if mode === 'complete'}
+
+ {:else if mode === 'chat'}
+
+ {#each messages as message, idx}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/each}
+
+
+
+ {/if}
+
+
+
+ {#if !loading}
+
+ {:else}
+
+ {/if}
+