mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-17 20:31:47 +02:00
ui : stop the conversation model from switching backends
Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
+15
-3
@@ -1,7 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { ModelsSelectorDropdown, ModelsSelectorSheet } from '$lib/components/app';
|
||||
import { useBackendAvailability } from '$lib/hooks/use-backend-availability.svelte';
|
||||
import { conversationsStore, deviceStore, modelsStore, serverStore } from '$lib/stores';
|
||||
import {
|
||||
backendsStore,
|
||||
conversationsStore,
|
||||
deviceStore,
|
||||
modelsStore,
|
||||
serverStore
|
||||
} from '$lib/stores';
|
||||
import { getConversationModel } from '$lib/utils';
|
||||
|
||||
interface Props {
|
||||
@@ -54,10 +60,16 @@
|
||||
|
||||
$effect(() => {
|
||||
if (conversationModel && conversationModel !== lastSyncedConversationModel) {
|
||||
if (modelsStore.models.some((m) => m.model === conversationModel)) {
|
||||
const option = modelsStore.models.find((m) => m.model === conversationModel);
|
||||
|
||||
// only sync models served by the active backend; a model from another
|
||||
// backend must not yank the active tab (and trigger a full backend
|
||||
// switch) just because the conversation used it. sends resolve their
|
||||
// backend explicitly via ensureModelBackend
|
||||
if (option && option.backendId === backendsStore.active.id) {
|
||||
modelsStore.selectedModelName = conversationModel;
|
||||
modelsStore.selectModelByName(conversationModel);
|
||||
} else {
|
||||
} else if (!option) {
|
||||
modelsStore.selectedModelName = null;
|
||||
modelsStore.clearSelection();
|
||||
}
|
||||
|
||||
@@ -164,6 +164,10 @@ export class ModelPropsManager {
|
||||
// /props only exists on llama.cpp servers
|
||||
if (!serverStore.capabilities.props) return null;
|
||||
|
||||
// props not loaded yet (mid backend switch): the server role and model
|
||||
// load state are not trustworthy, so do not guess
|
||||
if (!serverStore.props) return null;
|
||||
|
||||
const cached = this.cache.get(modelId);
|
||||
|
||||
if (cached) return cached;
|
||||
|
||||
Reference in New Issue
Block a user