format
Browse files- src/lib/components/InferencePlayground/InferencePlayground.svelte +41 -15
- src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte +18 -18
- src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte +1 -1
- src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte +6 -3
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -186,11 +186,11 @@
|
|
186 |
|
187 |
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
188 |
<div
|
189 |
-
class="w-dvh grid divide-gray-200 overflow-hidden bg-gray-100/50 max-md:
|
190 |
>
|
191 |
-
<div class="flex flex-col overflow-y-auto py-3 max-md:pl-3
|
192 |
<div
|
193 |
-
class="relative flex flex-1 flex-col gap-6 overflow-y-hidden
|
194 |
class:pointer-events-none={!systemPromptSupported}
|
195 |
class:opacity-70={!systemPromptSupported}
|
196 |
>
|
@@ -220,17 +220,43 @@
|
|
220 |
/>
|
221 |
</div>
|
222 |
<div
|
223 |
-
class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap px-3 md:absolute
|
224 |
>
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
<button
|
235 |
type="button"
|
236 |
on:click={reset}
|
@@ -283,9 +309,9 @@
|
|
283 |
</button>
|
284 |
</div>
|
285 |
</div>
|
286 |
-
<div class="flex flex-col p-3 {viewSettings ? 'max-md:fixed' : 'max-md:hidden'} max-md:inset-x-0 max-md:bottom-20
|
287 |
<div
|
288 |
-
class="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-xl border
|
289 |
>
|
290 |
<ModelSelector {models} bind:conversation />
|
291 |
|
|
|
186 |
|
187 |
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
188 |
<div
|
189 |
+
class="w-dvh grid h-dvh divide-gray-200 overflow-hidden bg-gray-100/50 max-md:grid-rows-[120px,1fr] max-md:divide-y md:grid-cols-[clamp(220px,20%,350px),minmax(0,1fr),clamp(270px,25%,300px)] dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300 dark:[color-scheme:dark]"
|
190 |
>
|
191 |
+
<div class="flex flex-col overflow-y-auto py-3 pr-3 max-md:pl-3">
|
192 |
<div
|
193 |
+
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 max-md:rounded-xl dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"
|
194 |
class:pointer-events-none={!systemPromptSupported}
|
195 |
class:opacity-70={!systemPromptSupported}
|
196 |
>
|
|
|
220 |
/>
|
221 |
</div>
|
222 |
<div
|
223 |
+
class="fixed inset-x-0 bottom-0 flex h-20 items-center gap-2 overflow-hidden whitespace-nowrap bg-white px-3 md:absolute dark:bg-gray-900"
|
224 |
>
|
225 |
+
<button
|
226 |
+
type="button"
|
227 |
+
on:click={() => (viewSettings = !viewSettings)}
|
228 |
+
class="flex h-[39px] items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2.5 text-sm font-medium text-gray-900 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:outline-none focus:ring-4 focus:ring-gray-100 md:hidden dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
|
229 |
+
>
|
230 |
+
<svg
|
231 |
+
class="text-black dark:text-white"
|
232 |
+
style=""
|
233 |
+
xmlns="http://www.w3.org/2000/svg"
|
234 |
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
235 |
+
aria-hidden="true"
|
236 |
+
focusable="false"
|
237 |
+
role="img"
|
238 |
+
width="1em"
|
239 |
+
height="1em"
|
240 |
+
preserveAspectRatio="xMidYMid meet"
|
241 |
+
viewBox="0 0 24 24"
|
242 |
+
><path
|
243 |
+
class="uim-quaternary"
|
244 |
+
d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z"
|
245 |
+
opacity=".25"
|
246 |
+
fill="currentColor"
|
247 |
+
></path><path
|
248 |
+
class="uim-tertiary"
|
249 |
+
d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z"
|
250 |
+
opacity=".5"
|
251 |
+
fill="currentColor"
|
252 |
+
></path><path
|
253 |
+
class="uim-primary"
|
254 |
+
d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z"
|
255 |
+
fill="currentColor"
|
256 |
+
></path></svg
|
257 |
+
>
|
258 |
+
{!viewSettings ? "Settings" : "Hide Settings"}
|
259 |
+
</button>
|
260 |
<button
|
261 |
type="button"
|
262 |
on:click={reset}
|
|
|
309 |
</button>
|
310 |
</div>
|
311 |
</div>
|
312 |
+
<div class="flex flex-col p-3 {viewSettings ? 'max-md:fixed' : 'max-md:hidden'} max-md:inset-x-0 max-md:bottom-20">
|
313 |
<div
|
314 |
+
class="flex flex-1 flex-col gap-6 overflow-y-hidden rounded-xl border border-gray-200/80 bg-white bg-gradient-to-b from-white via-white p-3 shadow-sm dark:border-white/5 dark:bg-gray-900 dark:from-gray-800/40 dark:via-gray-800/40"
|
315 |
>
|
316 |
<ModelSelector {models} bind:conversation />
|
317 |
|
src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte
CHANGED
@@ -293,7 +293,7 @@ print(output.choices[0].message)`,
|
|
293 |
</div>
|
294 |
|
295 |
{#each snippetsByLanguage[selectedLanguage] as { label, code, language, needsToken }}
|
296 |
-
<div class="flex items-center justify-between px-2
|
297 |
<h2 class="font-semibold">{label}</h2>
|
298 |
<div class="flex items-center gap-x-4">
|
299 |
{#if needsToken && hfToken}
|
@@ -302,23 +302,23 @@ print(output.choices[0].message)`,
|
|
302 |
<p class="leading-none">show token</p>
|
303 |
</label>
|
304 |
{/if}
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
</div>
|
323 |
<pre
|
324 |
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">{@html highlight(
|
|
|
293 |
</div>
|
294 |
|
295 |
{#each snippetsByLanguage[selectedLanguage] as { label, code, language, needsToken }}
|
296 |
+
<div class="flex items-center justify-between px-2 pb-4 pt-6 md:px-4">
|
297 |
<h2 class="font-semibold">{label}</h2>
|
298 |
<div class="flex items-center gap-x-4">
|
299 |
{#if needsToken && hfToken}
|
|
|
302 |
<p class="leading-none">show token</p>
|
303 |
</label>
|
304 |
{/if}
|
305 |
+
<button
|
306 |
+
class="flex items-center gap-x-1.5 rounded-md bg-gray-200 px-1.5 py-0.5 text-sm transition dark:bg-gray-950/80"
|
307 |
+
on:click={e => {
|
308 |
+
const el = e.currentTarget;
|
309 |
+
el.classList.add("text-green-500");
|
310 |
+
navigator.clipboard.writeText(code);
|
311 |
+
if (timeout) {
|
312 |
+
clearTimeout(timeout);
|
313 |
+
}
|
314 |
+
timeout = setTimeout(() => {
|
315 |
+
el.classList.remove("text-green-500");
|
316 |
+
}, 400);
|
317 |
+
}}
|
318 |
+
>
|
319 |
+
<IconCopyCode /> Copy code
|
320 |
+
</button>
|
321 |
+
</div>
|
322 |
</div>
|
323 |
<pre
|
324 |
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">{@html highlight(
|
src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte
CHANGED
@@ -54,7 +54,7 @@
|
|
54 |
</label>
|
55 |
|
56 |
<button
|
57 |
-
class="flex items-center justify-between gap-6 overflow-hidden whitespace-nowrap rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight shadow dark:
|
58 |
on:click={() => (showModelPickerModal = true)}
|
59 |
>
|
60 |
<div class="flex flex-col items-start">
|
|
|
54 |
</label>
|
55 |
|
56 |
<button
|
57 |
+
class="flex items-center justify-between gap-6 overflow-hidden whitespace-nowrap rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight shadow dark:border-gray-700 dark:bg-gray-800"
|
58 |
on:click={() => (showModelPickerModal = true)}
|
59 |
>
|
60 |
<div class="flex flex-col items-start">
|
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte
CHANGED
@@ -96,9 +96,12 @@
|
|
96 |
bind:this={backdropEl}
|
97 |
on:click|stopPropagation={handleBackdropClick}
|
98 |
>
|
99 |
-
<div class="flex w-full max-w-[600px] items-start justify-center
|
100 |
-
<div
|
101 |
-
|
|
|
|
|
|
|
102 |
<IconSearch classNames="mr-2 text-sm" />
|
103 |
<input
|
104 |
autofocus
|
|
|
96 |
bind:this={backdropEl}
|
97 |
on:click|stopPropagation={handleBackdropClick}
|
98 |
>
|
99 |
+
<div class="flex w-full max-w-[600px] items-start justify-center overflow-hidden whitespace-nowrap p-10">
|
100 |
+
<div
|
101 |
+
class="flex h-full w-full flex-col overflow-hidden rounded-lg border bg-white text-gray-900 shadow-md dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300"
|
102 |
+
bind:this={containerEl}
|
103 |
+
>
|
104 |
+
<div class="flex items-center border-b px-3 dark:border-gray-800">
|
105 |
<IconSearch classNames="mr-2 text-sm" />
|
106 |
<input
|
107 |
autofocus
|