refactor: Update chat and knowledge base handling for improved flexibility

- Removed validation for empty knowledge_base_ids in useStream, allowing backend to manage this case.
- Adjusted routing in KnowledgeBase.vue to decouple session creation from knowledge base ID.
- Updated getCurrentKbId function to simplify knowledge base ID retrieval from the route.
- Enhanced comments for clarity regarding knowledge base handling in chat components.
This commit is contained in:
wizardchen
2025-11-07 01:06:25 +08:00
parent 4fb12545c1
commit 288dfbd19e
4 changed files with 15 additions and 40 deletions
+2 -5
View File
@@ -228,11 +228,8 @@ const sendMsg = async (value) => {
scrollToBottom();
// Always use agent mode with unified architecture
// Get knowledge_base_ids from session's agent_config.knowledge_bases to update SessionAgentConfig
let kbIds = [];
if (sessionData.value?.agent_config?.knowledge_bases?.length > 0) {
kbIds = sessionData.value.agent_config.knowledge_bases;
}
// Get knowledge_base_ids from settings store (selected by user via KnowledgeBaseSelector)
const kbIds = useSettingsStoreInstance.settings.selectedKnowledgeBases || [];
// Validate knowledge_base_ids before sending
if (kbIds.length === 0) {