victor HF staff commited on
Commit
411fba2
1 Parent(s): 090ecca

playground

Browse files
src/lib/components/Playground/Playground.svelte CHANGED
@@ -5,13 +5,7 @@
5
  import PlaygroundMessage from '$lib/components/Playground/PlaygroundMessage.svelte';
6
  import PlaygroundOptions from '$lib/components/Playground/PlaygroundOptions.svelte';
7
  import PlaygroundTokenModal from './PlaygroundTokenModal.svelte';
8
-
9
- type Message = {
10
- role: string;
11
- content: string;
12
- };
13
-
14
- $: console.log(messages);
15
 
16
  const compatibleModels: string[] = [
17
  '01-ai/Yi-1.5-34B-Chat',
@@ -165,7 +159,7 @@
165
  {/if}
166
 
167
  <div
168
- class="w-dvh maxdivide-gray-200 grid overflow-hidden max-md:grid-cols-1 max-md:divide-y md:h-dvh md:grid-cols-[260px,minmax(0,1fr),260px] md:divide-x dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300"
169
  >
170
  <div class="relative flex flex-col overflow-y-auto px-5 pb-24 pt-7">
171
  <div class="pb-2 text-sm font-semibold">SYSTEM</div>
@@ -303,15 +297,9 @@
303
  </button>
304
  </div>
305
  </div>
306
- <div class="flex flex-col gap-6 overflow-hidden p-5">
307
- <PlaygroundOptions
308
- {compatibleModels}
309
- bind:currentModel
310
- bind:temperature
311
- bind:maxTokens
312
- bind:jsonMode
313
- bind:streaming
314
- />
315
  <div
316
  class="mt-auto flex max-w-xs flex-col items-start gap-2.5 rounded-lg border bg-white p-4 text-gray-500 shadow dark:border-gray-800 dark:bg-gray-800/50 dark:text-gray-400"
317
  role="alert"
 
5
  import PlaygroundMessage from '$lib/components/Playground/PlaygroundMessage.svelte';
6
  import PlaygroundOptions from '$lib/components/Playground/PlaygroundOptions.svelte';
7
  import PlaygroundTokenModal from './PlaygroundTokenModal.svelte';
8
+ import PlaygroundModelSelector from './PlaygroundModelSelector.svelte';
 
 
 
 
 
 
9
 
10
  const compatibleModels: string[] = [
11
  '01-ai/Yi-1.5-34B-Chat',
 
159
  {/if}
160
 
161
  <div
162
+ class="w-dvh maxdivide-gray-200 grid overflow-hidden max-md:grid-cols-1 max-md:divide-y md:h-dvh md:grid-cols-[260px,minmax(0,1fr),270px] md:divide-x dark:divide-gray-800 dark:bg-gray-900 dark:text-gray-300"
163
  >
164
  <div class="relative flex flex-col overflow-y-auto px-5 pb-24 pt-7">
165
  <div class="pb-2 text-sm font-semibold">SYSTEM</div>
 
297
  </button>
298
  </div>
299
  </div>
300
+ <div class="flex flex-col gap-6 overflow-y-hidden p-5">
301
+ <PlaygroundModelSelector {compatibleModels} bind:currentModel />
302
+ <PlaygroundOptions bind:temperature bind:maxTokens bind:jsonMode bind:streaming />
 
 
 
 
 
 
303
  <div
304
  class="mt-auto flex max-w-xs flex-col items-start gap-2.5 rounded-lg border bg-white p-4 text-gray-500 shadow dark:border-gray-800 dark:bg-gray-800/50 dark:text-gray-400"
305
  role="alert"
src/lib/components/Playground/PlaygroundModelSelector.svelte CHANGED
@@ -1,62 +1,20 @@
1
- <div class="m-12">
2
- <div class="relative">
3
- <button
4
- class="flex items-center gap-6 whitespace-nowrap rounded-lg border bg-white px-3 py-1.5 leading-tight shadow dark:bg-gray-700"
5
- >
6
- <div class="flex flex-col items-start text-sm">
7
- <div class="text-gray-500 dark:text-gray-300">meta-llama</div>
8
- <div>Meta-Llama-3-70B-Instruct</div>
9
- </div>
10
- <div class="size-5 bg-red-50"></div>
11
- </button>
12
- <div class="z-10 w-72 overflow-hidden rounded-lg bg-white shadow dark:bg-gray-700">
13
- <div>
14
- <label for="input-group-search" class="sr-only">Search Models</label>
15
- <div class="relative">
16
- <div
17
- class="rtl:inset-r-0 pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3"
18
- >
19
- <svg
20
- class="size-3 text-gray-500 dark:text-gray-400"
21
- aria-hidden="true"
22
- xmlns="http://www.w3.org/2000/svg"
23
- fill="none"
24
- viewBox="0 0 20 20"
25
- >
26
- <path
27
- stroke="currentColor"
28
- stroke-linecap="round"
29
- stroke-linejoin="round"
30
- stroke-width="2"
31
- d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
32
- />
33
- </svg>
34
- </div>
35
- <input
36
- type="text"
37
- id="input-group-search"
38
- class="block w-full border-b border-gray-300 bg-gray-50 p-2 ps-10 text-sm text-gray-900 focus:outline-none dark:border-gray-500 dark:bg-gray-600 dark:text-white"
39
- placeholder="Search model"
40
- />
41
- </div>
42
- </div>
43
- <ul class="h-48 overflow-y-auto pb-3 text-sm text-gray-700 dark:text-gray-200">
44
- <li>
45
- <div class="flex items-center rounded p-3 hover:bg-gray-100 dark:hover:bg-gray-600">
46
- <label
47
- for="checkbox-item-11"
48
- class="w-full rounded text-sm font-medium text-gray-900 dark:text-gray-300"
49
- >Bonnie Green</label
50
- >
51
- </div>
52
- </li>
53
- </ul>
54
- <a
55
- href="#"
56
- class="flex items-center rounded-b-lg border-t border-gray-200 bg-gray-50 p-3 text-sm font-medium text-red-600 hover:bg-gray-100 hover:underline dark:border-gray-600 dark:bg-gray-700 dark:text-red-500 dark:hover:bg-gray-600"
57
- >
58
- Reset
59
- </a>
60
- </div>
61
- </div>
62
  </div>
 
1
+ <script lang="ts">
2
+ export let compatibleModels: string[] = [];
3
+ export let currentModel = compatibleModels[0];
4
+ </script>
5
+
6
+ <div>
7
+ <label
8
+ for="countries"
9
+ class="mb-2 flex items-baseline text-sm font-medium text-gray-900 dark:text-white"
10
+ >Models<span class="ml-4 font-normal text-gray-400">{compatibleModels.length}</span>
11
+ </label>
12
+ <select
13
+ bind:value={currentModel}
14
+ class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
15
+ >
16
+ {#each compatibleModels as model}
17
+ <option value={model}>{model}</option>
18
+ {/each}
19
+ </select>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  </div>
src/lib/components/Playground/PlaygroundModelSelectorV2.svelte ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="relative z-10">
2
+ <button
3
+ class="flex items-center gap-5 whitespace-nowrap rounded-lg border bg-white px-3 py-1.5 leading-tight shadow dark:bg-gray-700"
4
+ >
5
+ <div class="flex flex-col items-start text-sm">
6
+ <div class="text-gray-500 dark:text-gray-300">meta-llama</div>
7
+ <div>Meta-Llama-3-70B-Instruct</div>
8
+ </div>
9
+ <div class="size-5 bg-red-50"></div>
10
+ </button>
11
+ <div
12
+ class="absolute right-0 z-10 w-96 overflow-hidden rounded-lg border bg-white shadow-lg dark:bg-gray-700"
13
+ >
14
+ <div>
15
+ <label for="input-group-search" class="sr-only">Search Models</label>
16
+ <div class="relative">
17
+ <div
18
+ class="rtl:inset-r-0 pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3"
19
+ >
20
+ <svg
21
+ class="size-3 text-gray-500 dark:text-gray-400"
22
+ aria-hidden="true"
23
+ xmlns="http://www.w3.org/2000/svg"
24
+ fill="none"
25
+ viewBox="0 0 20 20"
26
+ >
27
+ <path
28
+ stroke="currentColor"
29
+ stroke-linecap="round"
30
+ stroke-linejoin="round"
31
+ stroke-width="2"
32
+ d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"
33
+ />
34
+ </svg>
35
+ </div>
36
+ <input
37
+ type="text"
38
+ id="input-group-search"
39
+ class="block w-full border-b border-gray-300 bg-gray-50 p-2 ps-10 text-sm text-gray-900 focus:outline-none dark:border-gray-500 dark:bg-gray-600 dark:text-white"
40
+ placeholder="Search model"
41
+ />
42
+ </div>
43
+ </div>
44
+ <ul class="h-48 overflow-y-auto pb-3 text-sm text-gray-700 dark:text-gray-200">
45
+ <li>
46
+ <div class="flex items-center rounded p-3 hover:bg-gray-100 dark:hover:bg-gray-600">
47
+ <label
48
+ for="checkbox-item-11"
49
+ class="w-full rounded text-sm font-medium text-gray-900 dark:text-gray-300"
50
+ >Bonnie Green</label
51
+ >
52
+ </div>
53
+ </li>
54
+ </ul>
55
+ <a
56
+ href="#"
57
+ class="flex items-center rounded-b-lg border-t border-gray-200 bg-gray-50 p-3 text-sm font-medium text-red-600 hover:bg-gray-100 hover:underline dark:border-gray-600 dark:bg-gray-700 dark:text-red-500 dark:hover:bg-gray-600"
58
+ >
59
+ Reset
60
+ </a>
61
+ </div>
62
+ </div>
src/lib/components/Playground/PlaygroundOptions.svelte CHANGED
@@ -1,26 +1,9 @@
1
  <script lang="ts">
2
- export let compatibleModels: string[] = [];
3
- export let currentModel = compatibleModels[0];
4
  export let temperature = 0.5;
5
  export let maxTokens = 2048;
6
  export let streaming = true;
7
  </script>
8
 
9
- <div>
10
- <label
11
- for="countries"
12
- class="mb-2 flex items-baseline text-sm font-medium text-gray-900 dark:text-white"
13
- >Models<span class="ml-4 font-normal text-gray-400">{compatibleModels.length}</span>
14
- </label>
15
- <select
16
- bind:value={currentModel}
17
- class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
18
- >
19
- {#each compatibleModels as model}
20
- <option value={model}>{model}</option>
21
- {/each}
22
- </select>
23
- </div>
24
  <div>
25
  <div class="flex items-center justify-between">
26
  <label
 
1
  <script lang="ts">
 
 
2
  export let temperature = 0.5;
3
  export let maxTokens = 2048;
4
  export let streaming = true;
5
  </script>
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <div>
8
  <div class="flex items-center justify-between">
9
  <label