Browse Source

refac: model tools behaviour

Timothy Jaeryang Baek 5 months ago
parent
commit
6ac503413f
1 changed files with 15 additions and 0 deletions
  1. 15 0
      src/lib/components/chat/Chat.svelte

+ 15 - 0
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));