multi conv
Browse files
src/lib/components/Playground/Playground.svelte
CHANGED
@@ -215,7 +215,7 @@
|
|
215 |
></textarea>
|
216 |
</div>
|
217 |
</div>
|
218 |
-
<div class="relative divide-y divide-gray-200 dark:divide-gray-800">
|
219 |
<div
|
220 |
class="flex h-[calc(100dvh-5rem)] divide-x divide-gray-200 {conversations.length === 2
|
221 |
? '*:w-1/2'
|
@@ -223,19 +223,24 @@
|
|
223 |
? '*:w-1/3'
|
224 |
: '*:w-full'} dark:divide-gray-800"
|
225 |
>
|
226 |
-
{#each conversations as conversation}
|
227 |
<div
|
228 |
-
class="flex max-h-[calc(100dvh-
|
229 |
bind:this={messageContainer}
|
230 |
>
|
231 |
{#if conversations.length > 1}
|
232 |
-
<div
|
|
|
|
|
|
|
|
|
233 |
{conversation.model}
|
234 |
</div>
|
235 |
{/if}
|
236 |
{#if !viewCode}
|
237 |
{#each messages as message, i}
|
238 |
<PlaygroundMessage
|
|
|
239 |
{message}
|
240 |
on:delete={() => deleteMessage(i)}
|
241 |
autofocus={!loading && i === messages.length - 1}
|
@@ -268,7 +273,7 @@
|
|
268 |
{/each}
|
269 |
</div>
|
270 |
<div
|
271 |
-
class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap px-
|
272 |
>
|
273 |
<button
|
274 |
type="button"
|
@@ -362,9 +367,9 @@
|
|
362 |
</div>
|
363 |
</div>
|
364 |
{#if conversations.length === 1}
|
365 |
-
<div class="flex flex-col
|
366 |
<div
|
367 |
-
class="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-
|
368 |
>
|
369 |
<PlaygroundModelSelector {compatibleModels} bind:currentModel={currentConversation.model} />
|
370 |
<PlaygroundOptions
|
|
|
215 |
></textarea>
|
216 |
</div>
|
217 |
</div>
|
218 |
+
<div class="relative divide-y divide-gray-200 pt-3 dark:divide-gray-800">
|
219 |
<div
|
220 |
class="flex h-[calc(100dvh-5rem)] divide-x divide-gray-200 {conversations.length === 2
|
221 |
? '*:w-1/2'
|
|
|
223 |
? '*:w-1/3'
|
224 |
: '*:w-full'} dark:divide-gray-800"
|
225 |
>
|
226 |
+
{#each conversations as conversation, index}
|
227 |
<div
|
228 |
+
class="flex max-h-[calc(100dvh-5.8rem)] flex-col divide-y divide-gray-200 overflow-y-auto overflow-x-hidden @container dark:divide-gray-800"
|
229 |
bind:this={messageContainer}
|
230 |
>
|
231 |
{#if conversations.length > 1}
|
232 |
+
<div
|
233 |
+
class="flex flex h-10 flex-none items-center rounded-lg border border-gray-200/80 bg-white px-3 font-mono text-sm shadow-sm"
|
234 |
+
class:mr-3={index === 0}
|
235 |
+
class:mx-3={index === 1}
|
236 |
+
>
|
237 |
{conversation.model}
|
238 |
</div>
|
239 |
{/if}
|
240 |
{#if !viewCode}
|
241 |
{#each messages as message, i}
|
242 |
<PlaygroundMessage
|
243 |
+
class={i === 0 ? '!border-transparent' : ''}
|
244 |
{message}
|
245 |
on:delete={() => deleteMessage(i)}
|
246 |
autofocus={!loading && i === messages.length - 1}
|
|
|
273 |
{/each}
|
274 |
</div>
|
275 |
<div
|
276 |
+
class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap px-3 md:absolute"
|
277 |
>
|
278 |
<button
|
279 |
type="button"
|
|
|
367 |
</div>
|
368 |
</div>
|
369 |
{#if conversations.length === 1}
|
370 |
+
<div class="flex flex-col p-3">
|
371 |
<div
|
372 |
+
class="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-xl border border-gray-200/80 bg-gradient-to-b from-white via-white p-3 shadow-sm dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"
|
373 |
>
|
374 |
<PlaygroundModelSelector {compatibleModels} bind:currentModel={currentConversation.model} />
|
375 |
<PlaygroundOptions
|
src/lib/components/Playground/PlaygroundCode.svelte
CHANGED
@@ -64,14 +64,14 @@ for await (const chunk of hf.chatCompletionStream({
|
|
64 |
<h2 class="font-semibold">Install and instantiate</h2>
|
65 |
</div>
|
66 |
<pre
|
67 |
-
class="overflow-x-auto rounded-lg border border-gray-
|
68 |
|
69 |
<div class="px-4 pb-4 pt-6">
|
70 |
<h2 class="font-semibold">{streaming ? 'Streaming API' : 'Non-Streaming API'}</h2>
|
71 |
</div>
|
72 |
|
73 |
<pre
|
74 |
-
class="overflow-x-auto rounded-lg border border-gray-
|
75 |
? streamingSnippet
|
76 |
: nonStreamingSnippet}
|
77 |
</pre>
|
|
|
64 |
<h2 class="font-semibold">Install and instantiate</h2>
|
65 |
</div>
|
66 |
<pre
|
67 |
+
class="overflow-x-auto rounded-lg border border-gray-200/80 bg-white px-4 py-6 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-800/50">{npmSnippet}</pre>
|
68 |
|
69 |
<div class="px-4 pb-4 pt-6">
|
70 |
<h2 class="font-semibold">{streaming ? 'Streaming API' : 'Non-Streaming API'}</h2>
|
71 |
</div>
|
72 |
|
73 |
<pre
|
74 |
+
class="overflow-x-auto rounded-lg border border-gray-200/80 bg-white px-4 py-6 text-sm shadow-sm dark:border-gray-800 dark:bg-gray-800/50">{streaming
|
75 |
? streamingSnippet
|
76 |
: nonStreamingSnippet}
|
77 |
</pre>
|
src/lib/components/Playground/PlaygroundMessage.svelte
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
</script>
|
14 |
|
15 |
<div
|
16 |
-
class="group/message group grid grid-cols-[1fr,2.5rem] items-start gap-2 px-6 pb-6 pt-4 hover:bg-gray-50 @2xl:grid-cols-[130px,1fr,2.5rem] @2xl:grid-rows-1 @2xl:gap-4 dark:hover:bg-gray-800/50"
|
17 |
>
|
18 |
<div class="col-span-2 pb-1 pt-3 text-sm font-semibold uppercase @2xl:col-span-1 @2xl:pb-2">
|
19 |
{message.role}
|
|
|
13 |
</script>
|
14 |
|
15 |
<div
|
16 |
+
class="group/message group grid grid-cols-[1fr,2.5rem] items-start gap-2 px-6 pb-6 pt-4 hover:bg-gray-50 @2xl:grid-cols-[130px,1fr,2.5rem] @2xl:grid-rows-1 @2xl:gap-4 dark:hover:bg-gray-800/50 {$$props.class}"
|
17 |
>
|
18 |
<div class="col-span-2 pb-1 pt-3 text-sm font-semibold uppercase @2xl:col-span-1 @2xl:pb-2">
|
19 |
{message.role}
|