ui : show the assistant model selector for external backends

Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
Aleksander Grygier
2026-09-28 12:10:10 +02:00
parent b48698587e
commit 7e9895d4c6
2 changed files with 10 additions and 6 deletions
@@ -166,7 +166,6 @@
<ChatMessageAssistantModel
{displayedModel}
isLoading={chatStore.isLoading}
{isRouter}
{onRegenerate}
/>
@@ -1,17 +1,21 @@
<script lang="ts">
import { ModelBadge, ModelsSelectorDropdown } from '$lib/components/app';
import { ServerModelStatus } from '$lib/enums';
import { modelsStore } from '$lib/stores';
import { modelsStore, serverStore } from '$lib/stores';
import { copyToClipboard } from '$lib/utils';
interface Props {
displayedModel: string | null;
isRouter: boolean;
isLoading: boolean;
onRegenerate: (modelOverride?: string) => void;
}
let { displayedModel, isLoading, isRouter, onRegenerate }: Props = $props();
let { displayedModel, isLoading, onRegenerate }: Props = $props();
// same selectability rule as the form selector: router mode, or any backend
// that exposes a selectable model list
let isSelectable = $derived(serverStore.isRouterMode || !serverStore.capabilities.props);
let canLoadModels = $derived(serverStore.capabilities.loadUnload);
let pendingModel = $state<string | null>(null);
@@ -20,14 +24,15 @@
}
</script>
{#if isRouter}
{#if isSelectable}
<ModelsSelectorDropdown
currentModel={pendingModel ?? displayedModel}
disabled={isLoading}
onModelChange={async (modelId: string, modelName: string) => {
const status = modelsStore.getModelStatus(modelId);
if (status !== ServerModelStatus.LOADED) {
// external backends load the model implicitly on the request
if (canLoadModels && status !== ServerModelStatus.LOADED) {
pendingModel = modelId;
try {