Spaces:
Runtime error
Runtime error
correct highlgihting of selected model onmount
Browse files
src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte
CHANGED
|
@@ -35,6 +35,7 @@
|
|
| 35 |
{#if showModelPickerModal}
|
| 36 |
<ModelSelectorModal
|
| 37 |
{models}
|
|
|
|
| 38 |
on:modelSelected={e => changeModel(e.detail)}
|
| 39 |
on:close={e => (showModelPickerModal = false)}
|
| 40 |
/>
|
|
|
|
| 35 |
{#if showModelPickerModal}
|
| 36 |
<ModelSelectorModal
|
| 37 |
{models}
|
| 38 |
+
{conversation}
|
| 39 |
on:modelSelected={e => changeModel(e.detail)}
|
| 40 |
on:close={e => (showModelPickerModal = false)}
|
| 41 |
/>
|
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
-
import type { ModelEntryWithTokenizer } from "./types";
|
| 3 |
|
| 4 |
import { createEventDispatcher, tick } from "svelte";
|
| 5 |
|
|
@@ -8,6 +8,7 @@
|
|
| 8 |
import IconStar from "../Icons/IconStar.svelte";
|
| 9 |
|
| 10 |
export let models: ModelEntryWithTokenizer[];
|
|
|
|
| 11 |
|
| 12 |
let backdropEl: HTMLDivElement;
|
| 13 |
let query = "";
|
|
@@ -28,6 +29,12 @@
|
|
| 28 |
: !FEATUED_MODELS_IDS.includes(m.id)
|
| 29 |
);
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
function handleKeydown(event: KeyboardEvent) {
|
| 32 |
const { key } = event;
|
| 33 |
let scrollLogicalPosition: ScrollLogicalPosition = "end";
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
+
import type { Conversation, ModelEntryWithTokenizer } from "./types";
|
| 3 |
|
| 4 |
import { createEventDispatcher, tick } from "svelte";
|
| 5 |
|
|
|
|
| 8 |
import IconStar from "../Icons/IconStar.svelte";
|
| 9 |
|
| 10 |
export let models: ModelEntryWithTokenizer[];
|
| 11 |
+
export let conversation: Conversation;
|
| 12 |
|
| 13 |
let backdropEl: HTMLDivElement;
|
| 14 |
let query = "";
|
|
|
|
| 29 |
: !FEATUED_MODELS_IDS.includes(m.id)
|
| 30 |
);
|
| 31 |
|
| 32 |
+
if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {
|
| 33 |
+
highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);
|
| 34 |
+
} else {
|
| 35 |
+
highlightIdx = featuredModels.length + otherModels.findIndex(model => model.id === conversation.model.id);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
function handleKeydown(event: KeyboardEvent) {
|
| 39 |
const { key } = event;
|
| 40 |
let scrollLogicalPosition: ScrollLogicalPosition = "end";
|