Spaces:
Sleeping
Sleeping
fix model query search
Browse files10 unmodified lines111213141516171819202122232425262728293031323322 unmodified lines5657585960616224 unmodified lines87888990919214 unmodified lines10710810911011111211310 unmodified linesexport let conversation: Conversation;let backdropEl: HTMLDivElement;let query = "";let highlightIdx = 0;let ignoreCursorHighlight = false;let containerEl: HTMLDivElement;const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();const featuredModels = models.filter(m =>query? FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): FEATUED_MODELS_IDS.includes(m.id));const otherModels = models.filter(m =>query? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): !FEATUED_MODELS_IDS.includes(m.id));if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);22 unmodified lineshighlightIdx++;ignoreCursorHighlight = true;}const n = models.length;highlightIdx = ((highlightIdx % n) + n) % n;scrollToResult(scrollLogicalPosition);}24 unmodified linesdispatch("close");}}</script><svelte:window on:keydown={handleKeydown} on:mousemove={() => (ignoreCursorHighlight = false)} />14 unmodified linesautofocusclass="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-none"placeholder="Search models ..."bind:value={query}/></div><div class="max-h-[300px] overflow-y-auto overflow-x-hidden">10 unmodified lines111213141516171819202122232422 unmodified lines4748495051525324 unmodified lines787980818283848586878889909192939495969714 unmodified lines11211311411511611711810 unmodified linesexport let conversation: Conversation;let backdropEl: HTMLDivElement;let highlightIdx = 0;let ignoreCursorHighlight = false;let containerEl: HTMLDivElement;const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();let featuredModels = models.filter(m => FEATUED_MODELS_IDS.includes(m.id));let otherModels = models.filter(m => !FEATUED_MODELS_IDS.includes(m.id));if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);22 unmodified lineshighlightIdx++;ignoreCursorHighlight = true;}const n = featuredModels.length + otherModels.length;highlightIdx = ((highlightIdx % n) + n) % n;scrollToResult(scrollLogicalPosition);}24 unmodified linesdispatch("close");}}function filterModels(query: string) {featuredModels = models.filter(m =>query? FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): FEATUED_MODELS_IDS.includes(m.id));otherModels = models.filter(m =>query? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): !FEATUED_MODELS_IDS.includes(m.id));}</script><svelte:window on:keydown={handleKeydown} on:mousemove={() => (ignoreCursorHighlight = false)} />14 unmodified linesautofocusclass="flex h-10 w-full rounded-md bg-transparent py-3 text-sm placeholder-gray-400 outline-none"placeholder="Search models ..."on:input={e => filterModels(e.currentTarget.value)}/></div><div class="max-h-[300px] overflow-y-auto overflow-x-hidden">
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte+18-13