webui: Improvements for Models Selector UI (#20066)
This commit is contained in:
committed by
GitHub
parent
92f7da00b4
commit
5e335ba113
@@ -14,7 +14,7 @@
|
||||
import { Toaster } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { modelsStore } from '$lib/stores/models.svelte';
|
||||
import { TOOLTIP_DELAY_DURATION } from '$lib/constants/tooltip-config';
|
||||
import { TOOLTIP_DELAY_DURATION } from '$lib/constants';
|
||||
import { KeyboardKey } from '$lib/enums';
|
||||
import { IsMobile } from '$lib/hooks/is-mobile.svelte';
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { chatStore } from '$lib/stores/chat.svelte';
|
||||
import { conversationsStore, isConversationsInitialized } from '$lib/stores/conversations.svelte';
|
||||
import { modelsStore, modelOptions } from '$lib/stores/models.svelte';
|
||||
import { isRouterMode } from '$lib/stores/server.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/state';
|
||||
import { replaceState } from '$app/navigation';
|
||||
@@ -71,6 +72,14 @@
|
||||
conversationsStore.clearActiveConversation();
|
||||
chatStore.clearUIState();
|
||||
|
||||
if (
|
||||
isRouterMode() &&
|
||||
modelsStore.selectedModelName &&
|
||||
!modelsStore.isModelLoaded(modelsStore.selectedModelName)
|
||||
) {
|
||||
modelsStore.clearSelection();
|
||||
}
|
||||
|
||||
// Handle URL params only if we have ?q= or ?model= or ?new_chat=true
|
||||
if (qParam !== null || modelParam !== null || newChatParam === 'true') {
|
||||
await handleUrlParams();
|
||||
|
||||
@@ -99,10 +99,12 @@
|
||||
(option) => option.model === lastMessageWithModel.model
|
||||
);
|
||||
|
||||
if (matchingModel) {
|
||||
if (matchingModel && modelsStore.isModelLoaded(matchingModel.model)) {
|
||||
try {
|
||||
await modelsStore.selectModelById(matchingModel.id);
|
||||
console.log(`Automatically loaded model: ${lastMessageWithModel.model} from last message`);
|
||||
console.log(
|
||||
`Automatically selected model: ${lastMessageWithModel.model} from last message`
|
||||
);
|
||||
} catch (error) {
|
||||
console.warn('Failed to automatically select model from last message:', error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user