mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-10-03 19:37:29 -05:00
ui : show the assistant model selector for external backends
Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
-1
@@ -166,7 +166,6 @@
|
||||
<ChatMessageAssistantModel
|
||||
{displayedModel}
|
||||
isLoading={chatStore.isLoading}
|
||||
{isRouter}
|
||||
{onRegenerate}
|
||||
/>
|
||||
|
||||
|
||||
+10
-5
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user