Thomas G. Lopes commited on
Commit
c6f83f5
·
1 Parent(s): 0a3474b
.eslintignore DELETED
@@ -1,13 +0,0 @@
1
- .DS_Store
2
- node_modules
3
- /build
4
- /.svelte-kit
5
- /package
6
- .env
7
- .env.*
8
- !.env.example
9
-
10
- # Ignore files for PNPM, NPM and YARN
11
- pnpm-lock.yaml
12
- package-lock.json
13
- yarn.lock
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eslint.config.mts CHANGED
@@ -48,6 +48,7 @@ export default ts.config(
48
  rules: {
49
  "require-yield": "off",
50
  "@typescript-eslint/no-explicit-any": "error",
 
51
  // "@typescript-eslint/no-non-null-assertion": "error",
52
 
53
  "@typescript-eslint/no-unused-vars": [
@@ -59,6 +60,7 @@ export default ts.config(
59
 
60
  "object-shorthand": ["error", "always"],
61
  "svelte/no-at-html-tags": "off",
 
62
  "local/enforce-ext": [
63
  "error",
64
  {
 
48
  rules: {
49
  "require-yield": "off",
50
  "@typescript-eslint/no-explicit-any": "error",
51
+ "@typescript-eslint/no-unused-expressions": "off",
52
  // "@typescript-eslint/no-non-null-assertion": "error",
53
 
54
  "@typescript-eslint/no-unused-vars": [
 
60
 
61
  "object-shorthand": ["error", "always"],
62
  "svelte/no-at-html-tags": "off",
63
+ "svelte/require-each-key": "off",
64
  "local/enforce-ext": [
65
  "error",
66
  {
package.json CHANGED
@@ -21,7 +21,6 @@
21
  "@huggingface/tasks": "^0.17.1",
22
  "@iconify-json/carbon": "^1.2.8",
23
  "@iconify-json/material-symbols": "^1.2.15",
24
- "@melt-ui/svelte": "^0.86.3",
25
  "@ryoppippi/unplugin-typia": "^1.0.0",
26
  "@samchon/openapi": "^3.0.0",
27
  "@sveltejs/adapter-auto": "^3.2.2",
@@ -37,7 +36,7 @@
37
  "globals": "^16.0.0",
38
  "highlight.js": "^11.10.0",
39
  "jiti": "^2.4.2",
40
- "melt": "^0.17.3",
41
  "postcss": "^8.4.38",
42
  "prettier": "^3.1.1",
43
  "prettier-plugin-svelte": "^3.2.6",
 
21
  "@huggingface/tasks": "^0.17.1",
22
  "@iconify-json/carbon": "^1.2.8",
23
  "@iconify-json/material-symbols": "^1.2.15",
 
24
  "@ryoppippi/unplugin-typia": "^1.0.0",
25
  "@samchon/openapi": "^3.0.0",
26
  "@sveltejs/adapter-auto": "^3.2.2",
 
36
  "globals": "^16.0.0",
37
  "highlight.js": "^11.10.0",
38
  "jiti": "^2.4.2",
39
+ "melt": "^0.17.8",
40
  "postcss": "^8.4.38",
41
  "prettier": "^3.1.1",
42
  "prettier-plugin-svelte": "^3.2.6",
pnpm-lock.yaml CHANGED
@@ -36,9 +36,6 @@ importers:
36
  '@iconify-json/material-symbols':
37
  specifier: ^1.2.15
38
  version: 1.2.15
39
- '@melt-ui/svelte':
40
- specifier: ^0.86.3
41
- version: 0.86.3([email protected])
42
  '@ryoppippi/unplugin-typia':
43
  specifier: ^1.0.0
44
@@ -85,8 +82,8 @@ importers:
85
  specifier: ^2.4.2
86
  version: 2.4.2
87
  melt:
88
- specifier: ^0.17.3
89
- version: 0.17.3(@floating-ui/[email protected])([email protected])
90
  postcss:
91
  specifier: ^8.4.38
92
  version: 8.5.3
@@ -530,9 +527,6 @@ packages:
530
  '@iconify/[email protected]':
531
  resolution: {integrity: sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==}
532
 
533
- '@internationalized/[email protected]':
534
- resolution: {integrity: sha512-VJ5WS3fcVx0bejE/YHfbDKR/yawZgKqn/if+oEeLqNwBtPzVB06olkfcnojTmEMX+gTpH+FlQ69SHNitJ8/erQ==}
535
-
536
  '@jest/[email protected]':
537
  resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
538
  engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@@ -555,11 +549,6 @@ packages:
555
  '@jridgewell/[email protected]':
556
  resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
557
 
558
- '@melt-ui/[email protected]':
559
- resolution: {integrity: sha512-ZsWmHGd6P636mws1CgatlX7JtLkWoUBPXeNzPzvHYgZdagp8io8MPFotDIfRyKwTEQFUqF9fhBks6CWr0Nupuw==}
560
- peerDependencies:
561
- svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.118
562
-
563
  '@nodelib/[email protected]':
564
  resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
565
  engines: {node: '>= 8'}
@@ -758,9 +747,6 @@ packages:
758
  svelte: ^5.0.0-next.96 || ^5.0.0
759
  vite: ^5.0.0
760
 
761
- '@swc/[email protected]':
762
- resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==}
763
-
764
  '@tailwindcss/[email protected]':
765
  resolution: {integrity: sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==}
766
  peerDependencies:
@@ -1077,10 +1063,6 @@ packages:
1077
1078
  resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
1079
 
1080
1081
- resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
1082
- engines: {node: '>=6'}
1083
-
1084
1085
  resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==}
1086
  engines: {node: '>=0.10'}
@@ -1282,9 +1264,6 @@ packages:
1282
1283
  resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
1284
 
1285
1286
- resolution: {integrity: sha512-xx560wGBk7seZ6y933idtjJQc1l+ck+pI3sKvhKozdBV1dRZoKhkW5xoCaFv9tQiX5RH1xfSxjuNu6g+lmN/gw==}
1287
-
1288
1289
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
1290
  engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -1566,8 +1545,8 @@ packages:
1566
1567
  resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
1568
 
1569
1570
- resolution: {integrity: sha512-cQV/CvYNEW5JxkQLwNYG5cpZ1jSt1eLp2IPfWd94wAdaKhorAWGPc54CDaf1+wQcTSPkxIyJfKszsitTDUrOTA==}
1571
  peerDependencies:
1572
  '@floating-ui/dom': ^1.6.0
1573
  svelte: ^5.0.0
@@ -1975,9 +1954,6 @@ packages:
1975
  resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
1976
  engines: {node: ^14.18.0 || >=16.0.0}
1977
 
1978
1979
- resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==}
1980
-
1981
1982
  resolution: {integrity: sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==}
1983
 
@@ -2488,10 +2464,6 @@ snapshots:
2488
  transitivePeerDependencies:
2489
  - supports-color
2490
 
2491
- '@internationalized/[email protected]':
2492
- dependencies:
2493
- '@swc/helpers': 0.5.15
2494
-
2495
  '@jest/[email protected]':
2496
  dependencies:
2497
  '@sinclair/typebox': 0.27.8
@@ -2513,16 +2485,6 @@ snapshots:
2513
  '@jridgewell/resolve-uri': 3.1.2
2514
  '@jridgewell/sourcemap-codec': 1.5.0
2515
 
2516
2517
- dependencies:
2518
- '@floating-ui/core': 1.6.9
2519
- '@floating-ui/dom': 1.6.13
2520
- '@internationalized/date': 3.7.0
2521
- dequal: 2.0.3
2522
- focus-trap: 7.6.4
2523
- nanoid: 5.1.2
2524
- svelte: 5.23.0
2525
-
2526
  '@nodelib/[email protected]':
2527
  dependencies:
2528
  '@nodelib/fs.stat': 2.0.5
@@ -2722,10 +2684,6 @@ snapshots:
2722
  transitivePeerDependencies:
2723
  - supports-color
2724
 
2725
- '@swc/[email protected]':
2726
- dependencies:
2727
- tslib: 2.8.1
2728
-
2729
2730
  dependencies:
2731
  tailwindcss: 4.0.9
@@ -3019,8 +2977,6 @@ snapshots:
3019
 
3020
3021
 
3022
3023
-
3024
3025
 
3026
@@ -3277,10 +3233,6 @@ snapshots:
3277
 
3278
3279
 
3280
3281
- dependencies:
3282
- tabbable: 6.2.0
3283
-
3284
3285
  optional: true
3286
 
@@ -3519,7 +3471,7 @@ snapshots:
3519
  dependencies:
3520
  '@jridgewell/sourcemap-codec': 1.5.0
3521
 
3522
3523
  dependencies:
3524
  '@floating-ui/dom': 1.6.13
3525
  jest-axe: 9.0.0
@@ -3883,8 +3835,6 @@ snapshots:
3883
  '@pkgr/core': 0.1.1
3884
  tslib: 2.8.1
3885
 
3886
3887
-
3888
3889
 
3890
 
36
  '@iconify-json/material-symbols':
37
  specifier: ^1.2.15
38
  version: 1.2.15
 
 
 
39
  '@ryoppippi/unplugin-typia':
40
  specifier: ^1.0.0
41
 
82
  specifier: ^2.4.2
83
  version: 2.4.2
84
  melt:
85
+ specifier: ^0.17.8
86
+ version: 0.17.8(@floating-ui/[email protected])([email protected])
87
  postcss:
88
  specifier: ^8.4.38
89
  version: 8.5.3
 
527
  '@iconify/[email protected]':
528
  resolution: {integrity: sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==}
529
 
 
 
 
530
  '@jest/[email protected]':
531
  resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==}
532
  engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
 
549
  '@jridgewell/[email protected]':
550
  resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
551
 
 
 
 
 
 
552
  '@nodelib/[email protected]':
553
  resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
554
  engines: {node: '>= 8'}
 
747
  svelte: ^5.0.0-next.96 || ^5.0.0
748
  vite: ^5.0.0
749
 
 
 
 
750
  '@tailwindcss/[email protected]':
751
  resolution: {integrity: sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==}
752
  peerDependencies:
 
1063
1064
  resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==}
1065
 
 
 
 
 
1066
1067
  resolution: {integrity: sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==}
1068
  engines: {node: '>=0.10'}
 
1264
1265
  resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
1266
 
 
 
 
1267
1268
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
1269
  engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
 
1545
1546
  resolution: {integrity: sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==}
1547
 
1548
1549
+ resolution: {integrity: sha512-k2yRx3B4CTHylSOkXelYh6ds/0/NEhy/Q5pfpF4ETlZH6JZMlzhuO7bWKEuLTxqZ4X2tmAnrQTqWLtSzUB5uGA==}
1550
  peerDependencies:
1551
  '@floating-ui/dom': ^1.6.0
1552
  svelte: ^5.0.0
 
1954
  resolution: {integrity: sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==}
1955
  engines: {node: ^14.18.0 || >=16.0.0}
1956
 
 
 
 
1957
1958
  resolution: {integrity: sha512-l7z+OYZ7mu3DTqrL88RiKrKIqO3NcpEO8V/Od04bNpvk0kiIFndGEoqfuzvj4yuhRkHKjRkII2z+KS2HfPcSxw==}
1959
 
 
2464
  transitivePeerDependencies:
2465
  - supports-color
2466
 
 
 
 
 
2467
  '@jest/[email protected]':
2468
  dependencies:
2469
  '@sinclair/typebox': 0.27.8
 
2485
  '@jridgewell/resolve-uri': 3.1.2
2486
  '@jridgewell/sourcemap-codec': 1.5.0
2487
 
 
 
 
 
 
 
 
 
 
 
2488
  '@nodelib/[email protected]':
2489
  dependencies:
2490
  '@nodelib/fs.stat': 2.0.5
 
2684
  transitivePeerDependencies:
2685
  - supports-color
2686
 
 
 
 
 
2687
2688
  dependencies:
2689
  tailwindcss: 4.0.9
 
2977
 
2978
2979
 
 
 
2980
2981
 
2982
 
3233
 
3234
3235
 
 
 
 
 
3236
3237
  optional: true
3238
 
 
3471
  dependencies:
3472
  '@jridgewell/sourcemap-codec': 1.5.0
3473
 
3474
3475
  dependencies:
3476
  '@floating-ui/dom': 1.6.13
3477
  jest-axe: 9.0.0
 
3835
  '@pkgr/core': 0.1.1
3836
  tslib: 2.8.1
3837
 
 
 
3838
3839
 
3840
src/lib/components/debug-menu.svelte CHANGED
@@ -1,13 +1,13 @@
1
  <script lang="ts">
2
  import { dev } from "$app/environment";
3
  import { session } from "$lib/state/session.svelte.js";
4
- import { createPopover } from "@melt-ui/svelte";
5
- import { prompt } from "./prompts.svelte";
6
  import { token } from "$lib/state/token.svelte.js";
7
  import { compareStr } from "$lib/utils/compare.js";
 
 
 
8
  import type { ToastData } from "./toaster.svelte.js";
9
  import { addToast } from "./toaster.svelte.js";
10
- import { showQuotaModal } from "./quota-modal.svelte";
11
 
12
  let innerWidth = $state<number>();
13
  let innerHeight = $state<number>();
@@ -16,9 +16,7 @@
16
  document.body.classList.toggle("dark");
17
  }
18
 
19
- const {
20
- elements: { trigger, content },
21
- } = createPopover();
22
 
23
  type Action = {
24
  label: string;
@@ -72,10 +70,7 @@
72
  },
73
  ];
74
 
75
- addToast(
76
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
77
- toastData[Math.floor(Math.random() * toastData.length)]!
78
- );
79
  },
80
  },
81
  ].toSorted((a, b) => compareStr(a.label, b.label));
@@ -85,14 +80,13 @@
85
 
86
  {#if dev}
87
  <div class="abs-x-center fixed bottom-0 z-50">
88
- <button class="rounded-t-md bg-gray-500 px-3 py-1 text-xs text-white hover:bg-gray-600" {...$trigger} use:trigger>
89
  Debug
90
  </button>
91
 
92
  <div
93
  class="mb-2 w-128 rounded-lg border border-gray-200 bg-white p-4 shadow-lg dark:border-gray-700 dark:bg-gray-800"
94
- {...$content}
95
- use:content
96
  >
97
  <h3 class="mb-3 text-lg font-semibold dark:text-white">Debug Menu</h3>
98
 
 
1
  <script lang="ts">
2
  import { dev } from "$app/environment";
3
  import { session } from "$lib/state/session.svelte.js";
 
 
4
  import { token } from "$lib/state/token.svelte.js";
5
  import { compareStr } from "$lib/utils/compare.js";
6
+ import { Popover } from "melt/builders";
7
+ import { prompt } from "./prompts.svelte";
8
+ import { showQuotaModal } from "./quota-modal.svelte";
9
  import type { ToastData } from "./toaster.svelte.js";
10
  import { addToast } from "./toaster.svelte.js";
 
11
 
12
  let innerWidth = $state<number>();
13
  let innerHeight = $state<number>();
 
16
  document.body.classList.toggle("dark");
17
  }
18
 
19
+ const popover = new Popover();
 
 
20
 
21
  type Action = {
22
  label: string;
 
70
  },
71
  ];
72
 
73
+ addToast(toastData[Math.floor(Math.random() * toastData.length)]!);
 
 
 
74
  },
75
  },
76
  ].toSorted((a, b) => compareStr(a.label, b.label));
 
80
 
81
  {#if dev}
82
  <div class="abs-x-center fixed bottom-0 z-50">
83
+ <button class="rounded-t-md bg-gray-500 px-3 py-1 text-xs text-white hover:bg-gray-600" {...popover.trigger}>
84
  Debug
85
  </button>
86
 
87
  <div
88
  class="mb-2 w-128 rounded-lg border border-gray-200 bg-white p-4 shadow-lg dark:border-gray-700 dark:bg-gray-800"
89
+ {...popover.content}
 
90
  >
91
  <h3 class="mb-3 text-lg font-semibold dark:text-white">Debug Menu</h3>
92
 
src/lib/components/inference-playground/playground.svelte CHANGED
@@ -231,7 +231,7 @@
231
  <div
232
  class="flex h-[calc(100dvh-5rem-120px)] divide-x divide-gray-200 overflow-x-auto overflow-y-hidden *:w-full max-sm:w-dvw md:h-[calc(100dvh-5rem)] md:pt-3 dark:divide-gray-800"
233
  >
234
- {#each session.project.conversations as _conversation, conversationIdx}
235
  <div class="max-sm:min-w-full">
236
  {#if compareActive}
237
  <PlaygroundConversationHeader
 
231
  <div
232
  class="flex h-[calc(100dvh-5rem-120px)] divide-x divide-gray-200 overflow-x-auto overflow-y-hidden *:w-full max-sm:w-dvw md:h-[calc(100dvh-5rem)] md:pt-3 dark:divide-gray-800"
233
  >
234
+ {#each session.project.conversations as conversation, conversationIdx (conversation)}
235
  <div class="max-sm:min-w-full">
236
  {#if compareActive}
237
  <PlaygroundConversationHeader
src/lib/components/inference-playground/provider-select.svelte CHANGED
@@ -5,7 +5,7 @@
5
 
6
  import { randomPick } from "$lib/utils/array.js";
7
  import { cn } from "$lib/utils/cn.js";
8
- import { createSelect, createSync } from "@melt-ui/svelte";
9
  import IconCaret from "~icons/carbon/chevron-down";
10
  import IconProvider from "../icon-provider.svelte";
11
 
@@ -27,16 +27,11 @@
27
  reset(providers);
28
  });
29
 
30
- const {
31
- elements: { trigger, menu, option },
32
- states: { selected },
33
- } = createSelect<string, false>();
34
- const sync = createSync({ selected });
35
- run(() => {
36
- sync.selected(
37
- conversation.provider ? { value: conversation.provider } : undefined,
38
- p => (conversation.provider = p?.value)
39
- );
40
  });
41
 
42
  const nameMap: Record<string, string> = {
@@ -81,8 +76,7 @@
81
  -->
82
 
83
  <button
84
- {...$trigger}
85
- use:trigger
86
  class={cn(
87
  "relative flex items-center justify-between gap-6 overflow-hidden rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight whitespace-nowrap shadow-sm",
88
  "hover:brightness-95 dark:border-gray-700 dark:bg-gray-800 dark:hover:brightness-110",
@@ -100,9 +94,9 @@
100
  </div>
101
  </button>
102
 
103
- <div {...$menu} use:menu class="rounded-lg border bg-gray-100 dark:border-gray-700 dark:bg-gray-800">
104
  {#each conversation.model.inferenceProviderMapping as { provider, providerId } (provider + providerId)}
105
- <button {...$option({ value: provider })} use:option class="group block w-full p-1 text-sm dark:text-white">
106
  <div
107
  class="flex items-center gap-2 rounded-md px-2 py-1.5 group-data-[highlighted]:bg-gray-200 dark:group-data-[highlighted]:bg-gray-700"
108
  >
 
5
 
6
  import { randomPick } from "$lib/utils/array.js";
7
  import { cn } from "$lib/utils/cn.js";
8
+ import { Select } from "melt/builders";
9
  import IconCaret from "~icons/carbon/chevron-down";
10
  import IconProvider from "../icon-provider.svelte";
11
 
 
27
  reset(providers);
28
  });
29
 
30
+ const select = new Select<string, false>({
31
+ value: () => conversation.provider,
32
+ onValueChange(v) {
33
+ conversation.provider = v;
34
+ },
 
 
 
 
 
35
  });
36
 
37
  const nameMap: Record<string, string> = {
 
76
  -->
77
 
78
  <button
79
+ {...select.trigger}
 
80
  class={cn(
81
  "relative flex items-center justify-between gap-6 overflow-hidden rounded-lg border bg-gray-100/80 px-3 py-1.5 leading-tight whitespace-nowrap shadow-sm",
82
  "hover:brightness-95 dark:border-gray-700 dark:bg-gray-800 dark:hover:brightness-110",
 
94
  </div>
95
  </button>
96
 
97
+ <div {...select.content} class="rounded-lg border bg-gray-100 dark:border-gray-700 dark:bg-gray-800">
98
  {#each conversation.model.inferenceProviderMapping as { provider, providerId } (provider + providerId)}
99
+ <button {...select.getOption(provider)} class="group block w-full p-1 text-sm dark:text-white">
100
  <div
101
  class="flex items-center gap-2 rounded-md px-2 py-1.5 group-data-[highlighted]:bg-gray-200 dark:group-data-[highlighted]:bg-gray-700"
102
  >
src/lib/components/inference-playground/utils.ts CHANGED
@@ -50,7 +50,6 @@ export async function handleNonStreamingResponse(
50
  });
51
 
52
  if (response.choices && response.choices.length > 0) {
53
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
54
  const { message } = response.choices[0]!;
55
  const { completion_tokens } = response.usage;
56
  return { message, completion_tokens };
 
50
  });
51
 
52
  if (response.choices && response.choices.length > 0) {
 
53
  const { message } = response.choices[0]!;
54
  const { completion_tokens } = response.usage;
55
  return { message, completion_tokens };