diff --git a/src/lib/components/playground/ChatCompletion.svelte b/src/lib/components/playground/ChatCompletion.svelte
new file mode 100644
index 00000000..e3d822d6
--- /dev/null
+++ b/src/lib/components/playground/ChatCompletion.svelte
@@ -0,0 +1,105 @@
+
+
+
+ {#each messages as message, idx}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/each}
+
+
+
diff --git a/src/lib/components/playground/TextCompletion.svelte b/src/lib/components/playground/TextCompletion.svelte
new file mode 100644
index 00000000..e69de29b
diff --git a/src/routes/(app)/playground/+page.svelte b/src/routes/(app)/playground/+page.svelte
index 94e64292..a88590ec 100644
--- a/src/routes/(app)/playground/+page.svelte
+++ b/src/routes/(app)/playground/+page.svelte
@@ -17,6 +17,7 @@
import { generateOpenAIChatCompletion } from '$lib/apis/openai';
import { splitStream } from '$lib/utils';
+ import ChatCompletion from '$lib/components/playground/ChatCompletion.svelte';
let mode = 'chat';
let loaded = false;
@@ -38,9 +39,13 @@
];
const scrollToBottom = () => {
- // const element = document.getElementById('text-completion-textarea');
+ let element;
- const element = document.getElementById('messages-container');
+ if (mode === 'chat') {
+ element = document.getElementById('messages-container');
+ } else {
+ element = document.getElementById('text-completion-textarea');
+ }
if (element) {
element.scrollTop = element?.scrollHeight;
@@ -423,100 +428,7 @@
placeholder="You're a helpful assistant."
/>
{:else if mode === 'chat'}
-
- {#each messages as message, idx}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {/each}
-
-
-
+
{/if}
@@ -548,22 +460,6 @@
-
-