Skip to content

Commit df520ff

Browse files
committed
correct highlgihting of selected model onmount
1 parent 063b59f commit df520ff

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/lib/components/InferencePlayground/InferencePlaygroundModelSelector.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
{#if showModelPickerModal}
3636
<ModelSelectorModal
3737
{models}
38+
{conversation}
3839
on:modelSelected={e => changeModel(e.detail)}
3940
on:close={e => (showModelPickerModal = false)}
4041
/>

src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import type { ModelEntryWithTokenizer } from "./types";
2+
import type { Conversation, ModelEntryWithTokenizer } from "./types";
33
44
import { createEventDispatcher, tick } from "svelte";
55
@@ -8,6 +8,7 @@
88
import IconStar from "../Icons/IconStar.svelte";
99
1010
export let models: ModelEntryWithTokenizer[];
11+
export let conversation: Conversation;
1112
1213
let backdropEl: HTMLDivElement;
1314
let query = "";
@@ -28,6 +29,12 @@
2829
: !FEATUED_MODELS_IDS.includes(m.id)
2930
);
3031
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+
3138
function handleKeydown(event: KeyboardEvent) {
3239
const { key } = event;
3340
let scrollLogicalPosition: ScrollLogicalPosition = "end";

0 commit comments

Comments
 (0)