From 6ac503413fbe0c3427d3da11a9d2575361340711 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 16 Nov 2024 15:54:07 -0800 Subject: [PATCH] refac: model tools behaviour --- src/lib/components/chat/Chat.svelte | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 26f0498ff..3371f19d2 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -153,6 +153,21 @@ console.log('saveSessionSelectedModels', selectedModels, sessionStorage.selectedModels); }; + $: if (selectedModelIds) { + setToolIds(); + } + + const setToolIds = () => { + if (selectedModels.length !== 1) { + return; + } + + const model = $models.find((m) => m.id === selectedModels[0]); + if (model) { + selectedToolIds = model?.info?.meta?.toolIds ?? []; + } + }; + const showMessage = async (message) => { const _chatId = JSON.parse(JSON.stringify($chatId)); let _messageId = JSON.parse(JSON.stringify(message.id));