dispath model change
Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -196,6 +196,14 @@
|
|
196 |
function changeSelectedModel(modelIdx: number) {
|
197 |
conversations[0] = { ...conversations[0], model: models[modelIdx] };
|
198 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
</script>
|
200 |
|
201 |
{#if showTokenModal}
|
@@ -388,4 +396,4 @@
|
|
388 |
{/if}
|
389 |
</div>
|
390 |
|
391 |
-
<ModelPickerModal {models} />
|
|
|
196 |
function changeSelectedModel(modelIdx: number) {
|
197 |
conversations[0] = { ...conversations[0], model: models[modelIdx] };
|
198 |
}
|
199 |
+
|
200 |
+
function changeModel(modelId: string) {
|
201 |
+
const model = models.find((m) => m.id === modelId);
|
202 |
+
if (!model) {
|
203 |
+
return;
|
204 |
+
}
|
205 |
+
conversations[0].model = model;
|
206 |
+
}
|
207 |
</script>
|
208 |
|
209 |
{#if showTokenModal}
|
|
|
396 |
{/if}
|
397 |
</div>
|
398 |
|
399 |
+
<ModelPickerModal {models} on:modelSelected={(e) => changeModel(e.detail)} />
|
src/lib/components/InferencePlayground/InferencePlaygroundModelPickerModal.svelte
CHANGED
@@ -1,7 +1,10 @@
|
|
1 |
<script lang="ts">
|
2 |
import type { ModelEntryWithTokenizer } from '$lib/types';
|
|
|
3 |
|
4 |
export let models: ModelEntryWithTokenizer[];
|
|
|
|
|
5 |
</script>
|
6 |
|
7 |
<div class="fixed inset-0 flex h-screen items-start justify-center bg-black/85 pt-32">
|
@@ -86,13 +89,16 @@
|
|
86 |
<div>
|
87 |
{#each models as model}
|
88 |
{@const [nameSpace, modelName] = model.id.split('/')}
|
89 |
-
<
|
|
|
|
|
|
|
90 |
<span class="inline-flex items-center"
|
91 |
><span class="text-gray-500">{nameSpace}</span><span class="mx-1 text-black"
|
92 |
>/</span
|
93 |
><span class="text-black">{modelName}</span></span
|
94 |
>
|
95 |
-
</
|
96 |
{/each}
|
97 |
</div>
|
98 |
</div>
|
|
|
1 |
<script lang="ts">
|
2 |
import type { ModelEntryWithTokenizer } from '$lib/types';
|
3 |
+
import { createEventDispatcher } from 'svelte';
|
4 |
|
5 |
export let models: ModelEntryWithTokenizer[];
|
6 |
+
|
7 |
+
const dispatch = createEventDispatcher<{ modelSelected: string }>();
|
8 |
</script>
|
9 |
|
10 |
<div class="fixed inset-0 flex h-screen items-start justify-center bg-black/85 pt-32">
|
|
|
89 |
<div>
|
90 |
{#each models as model}
|
91 |
{@const [nameSpace, modelName] = model.id.split('/')}
|
92 |
+
<button
|
93 |
+
class="flex cursor-pointer items-center px-2 py-1.5 text-sm hover:bg-gray-100"
|
94 |
+
on:click={() => dispatch('modelSelected', model.id)}
|
95 |
+
>
|
96 |
<span class="inline-flex items-center"
|
97 |
><span class="text-gray-500">{nameSpace}</span><span class="mx-1 text-black"
|
98 |
>/</span
|
99 |
><span class="text-black">{modelName}</span></span
|
100 |
>
|
101 |
+
</button>
|
102 |
{/each}
|
103 |
</div>
|
104 |
</div>
|