{#if ms.loading && ms.options.length === 0 && ms.isRouter}
Loading models…
{:else if ms.options.length === 0 && ms.isRouter} {#if currentModel} {:else}

No models available.

{/if} {:else} {@const selectedOption = ms.getDisplayOption()} {@const triggerModel = selectedOption?.model} {@const triggerStatus = triggerModel ? routerModels().find((m) => m.id === triggerModel)?.status?.value : undefined} {@const triggerLoading = !!triggerModel && (triggerStatus === ServerModelStatus.LOADING || modelsStore.isModelOperationInProgress(triggerModel))} {@const triggerLoadPercent = triggerLoading ? Math.round(modelLoadFraction(modelsStore.getLoadProgress(triggerModel)) * 100) : 0} {#if ms.isRouter} {#snippet child({ props })} {#if selectedOption} {:else} Select model {/if} {#if ms.updating || ms.isLoadingModel} {:else} {/if} {#if triggerLoading} {/if} {/snippet} {#if selectedOption}

{selectedOption.model}

{/if}
ms.setSearchTerm(v)} placeholder="Search models..." onSearchKeyDown={handleSearchKeyDown} emptyMessage="No models found." isEmpty={ms.filteredOptions.length === 0 && ms.isCurrentModelInCache} >
{#if !ms.isCurrentModelInCache && currentModel} {/if} {#if ms.filteredOptions.length === 0}

No models found.

{/if} {#snippet modelOption(item: ModelItem, hideOrgName: boolean)} {@const { option, flatIndex } = item} {@const isSelected = currentModel === option.model || ms.activeId === option.id} {@const isHighlighted = flatIndex === highlightedIndex} {@const isFav = ms.isFavorite(option.model)} (highlightedIndex = flatIndex)} onKeyDown={(event) => { if (event.key === KeyboardKey.ENTER || event.key === KeyboardKey.SPACE) { event.preventDefault(); ms.handleSelect(option.id); } }} /> {/snippet}
{:else} {#snippet child({ props })} {/snippet} {#if selectedOption}

{selectedOption.model}

{/if}
{/if} {/if}
{#if ms.showModelDialog} ms.setShowModelDialog(v)} modelId={ms.infoModelId} /> {/if}