refac: model tools behaviour

This commit is contained in:
Timothy Jaeryang Baek 2024-11-16 15:54:07 -08:00
parent 7fe10763c1
commit 6ac503413f

View File

@ -153,6 +153,21 @@
console.log('saveSessionSelectedModels', selectedModels, sessionStorage.selectedModels); 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 showMessage = async (message) => {
const _chatId = JSON.parse(JSON.stringify($chatId)); const _chatId = JSON.parse(JSON.stringify($chatId));
let _messageId = JSON.parse(JSON.stringify(message.id)); let _messageId = JSON.parse(JSON.stringify(message.id));