Spaces:
Running
Running
compare with
Browse files
src/lib/components/Playground/Playground.svelte
CHANGED
@@ -45,12 +45,6 @@
|
|
45 |
model: '01-ai/Yi-1.5-34B-Chat',
|
46 |
config: { temperature: 0.5, maxTokens: 2048, streaming: true, jsonMode: false },
|
47 |
messages: startMessages
|
48 |
-
},
|
49 |
-
{
|
50 |
-
id: String(Math.random()),
|
51 |
-
model: 'google/gemma-1.1-2b-it',
|
52 |
-
config: { temperature: 0.5, maxTokens: 2048, streaming: true, jsonMode: false },
|
53 |
-
messages: startMessages
|
54 |
}
|
55 |
];
|
56 |
|
@@ -201,9 +195,9 @@
|
|
201 |
|
202 |
dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300"
|
203 |
>
|
204 |
-
<div class=" flex flex-col overflow-y-auto
|
205 |
<div
|
206 |
-
class="relative 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"
|
207 |
>
|
208 |
<div class="pb-2 text-sm font-semibold">SYSTEM</div>
|
209 |
<textarea
|
@@ -230,19 +224,20 @@
|
|
230 |
>
|
231 |
{#if conversations.length > 1}
|
232 |
<div
|
233 |
-
class="flex h-10 flex-none items-center gap-1.5 whitespace-nowrap rounded-lg border border-gray-200/80 bg-white
|
234 |
class:mr-3={index === 0}
|
235 |
class:mx-3={index === 1}
|
236 |
>
|
237 |
<div class="size-3.5 rounded bg-black"></div>
|
238 |
<div>{conversation.model}</div>
|
239 |
<button
|
240 |
-
class="ml-auto flex size-6 items-center justify-center rounded
|
|
|
241 |
>
|
242 |
✕
|
243 |
</button>
|
244 |
<button
|
245 |
-
class=" flex size-6 items-center justify-center rounded
|
246 |
>
|
247 |
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32"
|
248 |
><path
|
@@ -262,7 +257,7 @@
|
|
262 |
class="border-b"
|
263 |
{message}
|
264 |
on:delete={() => deleteMessage(i)}
|
265 |
-
autofocus={!loading && i === messages.length - 1}
|
266 |
/>
|
267 |
{/each}
|
268 |
|
@@ -391,6 +386,45 @@
|
|
391 |
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"
|
392 |
>
|
393 |
<PlaygroundModelSelector {compatibleModels} bind:currentModel={currentConversation.model} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
<PlaygroundOptions
|
395 |
bind:temperature={currentConversation.config.temperature}
|
396 |
bind:maxTokens={currentConversation.config.maxTokens}
|
|
|
45 |
model: '01-ai/Yi-1.5-34B-Chat',
|
46 |
config: { temperature: 0.5, maxTokens: 2048, streaming: true, jsonMode: false },
|
47 |
messages: startMessages
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
];
|
50 |
|
|
|
195 |
|
196 |
dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300"
|
197 |
>
|
198 |
+
<div class=" flex flex-col overflow-y-auto py-3 pr-3">
|
199 |
<div
|
200 |
+
class="relative flex flex-1 flex-col gap-6 overflow-y-hidden rounded-r-xl border-x border-y 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"
|
201 |
>
|
202 |
<div class="pb-2 text-sm font-semibold">SYSTEM</div>
|
203 |
<textarea
|
|
|
224 |
>
|
225 |
{#if conversations.length > 1}
|
226 |
<div
|
227 |
+
class="flex h-10 flex-none items-center gap-1.5 whitespace-nowrap rounded-lg border border-gray-200/80 bg-white pl-3 pr-2 text-sm leading-none shadow-sm *:flex-none"
|
228 |
class:mr-3={index === 0}
|
229 |
class:mx-3={index === 1}
|
230 |
>
|
231 |
<div class="size-3.5 rounded bg-black"></div>
|
232 |
<div>{conversation.model}</div>
|
233 |
<button
|
234 |
+
class="ml-auto flex size-6 items-center justify-center rounded bg-gray-50 text-xs hover:bg-gray-100"
|
235 |
+
on:click={() => (conversations = conversations.filter((_, i) => i !== index))}
|
236 |
>
|
237 |
✕
|
238 |
</button>
|
239 |
<button
|
240 |
+
class=" flex size-6 items-center justify-center rounded bg-gray-50 hover:bg-gray-100"
|
241 |
>
|
242 |
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32"
|
243 |
><path
|
|
|
257 |
class="border-b"
|
258 |
{message}
|
259 |
on:delete={() => deleteMessage(i)}
|
260 |
+
autofocus={conversations.length === 1 && !loading && i === messages.length - 1}
|
261 |
/>
|
262 |
{/each}
|
263 |
|
|
|
386 |
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"
|
387 |
>
|
388 |
<PlaygroundModelSelector {compatibleModels} bind:currentModel={currentConversation.model} />
|
389 |
+
<div
|
390 |
+
class="group relative -mt-4 flex h-[26px] w-full items-center justify-center gap-2 rounded-lg bg-black px-5 text-sm text-white hover:bg-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-300 dark:border-gray-700 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-gray-700"
|
391 |
+
>
|
392 |
+
Compare with...
|
393 |
+
<svg
|
394 |
+
class="ml-0.5 flex-none opacity-50 group-hover:opacity-100"
|
395 |
+
xmlns="http://www.w3.org/2000/svg"
|
396 |
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
397 |
+
aria-hidden="true"
|
398 |
+
role="img"
|
399 |
+
width="1em"
|
400 |
+
height="1em"
|
401 |
+
preserveAspectRatio="xMidYMid meet"
|
402 |
+
viewBox="0 0 24 24"
|
403 |
+
><path
|
404 |
+
d="M16.293 9.293L12 13.586L7.707 9.293l-1.414 1.414L12 16.414l5.707-5.707z"
|
405 |
+
fill="currentColor"
|
406 |
+
></path></svg
|
407 |
+
>
|
408 |
+
<select
|
409 |
+
class="absolute inset-0 border-none bg-white text-base opacity-0 outline-none"
|
410 |
+
on:change|preventDefault={(e) => {
|
411 |
+
conversations = [
|
412 |
+
...conversations,
|
413 |
+
{
|
414 |
+
id: String(Math.random()),
|
415 |
+
model: e.target.value,
|
416 |
+
config: { temperature: 0.5, maxTokens: 2048, streaming: true, jsonMode: false },
|
417 |
+
messages: startMessages
|
418 |
+
}
|
419 |
+
];
|
420 |
+
}}
|
421 |
+
>
|
422 |
+
{#each compatibleModels as model}
|
423 |
+
<option value={model}>{model}</option>
|
424 |
+
{/each}
|
425 |
+
</select>
|
426 |
+
</div>
|
427 |
+
|
428 |
<PlaygroundOptions
|
429 |
bind:temperature={currentConversation.config.temperature}
|
430 |
bind:maxTokens={currentConversation.config.maxTokens}
|