diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 1dab2af3e..e98ae5ca0 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -161,9 +161,6 @@ if (selectedModels.length !== 1) { return; } - - console.log('setToolIds', selectedModels); - const model = $models.find((m) => m.id === selectedModels[0]); if (model) { selectedToolIds = model?.info?.meta?.toolIds ?? []; @@ -830,9 +827,12 @@ console.log('submitPrompt', userPrompt, $chatId); const messages = createMessagesList(history.currentId); - selectedModels = selectedModels.map((modelId) => + const _selectedModels = selectedModels.map((modelId) => $models.map((m) => m.id).includes(modelId) ? modelId : '' ); + if (JSON.stringify(selectedModels) !== JSON.stringify(_selectedModels)) { + selectedModels = _selectedModels; + } if (userPrompt === '') { toast.error($i18n.t('Please enter a prompt')); diff --git a/src/lib/components/chat/MessageInput/InputMenu.svelte b/src/lib/components/chat/MessageInput/InputMenu.svelte index 8b5d5901d..2929428ca 100644 --- a/src/lib/components/chat/MessageInput/InputMenu.svelte +++ b/src/lib/components/chat/MessageInput/InputMenu.svelte @@ -89,9 +89,10 @@
{ + on:change={async (e) => { + const state = e.detail; await tick(); - if (tools[toolId].enabled) { + if (state) { selectedToolIds = [...selectedToolIds, toolId]; } else { selectedToolIds = selectedToolIds.filter((id) => id !== toolId);