mirror of
https://github.com/lobehub/lobehub.git
synced 2026-09-20 04:56:13 +08:00
5449f616d7
* 🐛 fix: stop Agent Documents from shadowing Knowledge Base for user file lookups Agent Documents' listDocuments and Knowledge Base's own tool descriptions both plausibly matched "find my file" style requests, with no cross-tool routing rule, so the model sometimes tried Agent Documents (agent-scoped notes, not the user's uploads) first and only found the file via the Cloud Sandbox `lh file list` fallback. Clarify scope boundaries and reinforce listFiles -> readKnowledge as the primary path (covers uncategorized/resource-library files without requiring KB membership or embedding), with searchKnowledgeBase and the CLI as later fallbacks. * 🐛 fix: don't dead-end Agent Documents when Knowledge Base tool is unavailable The Knowledge Base tool is gated behind hasEnabledKnowledgeBases (agent must have an enabled KB attached) both client- and server-side, while Agent Documents is unconditionally available. The previous scope_boundary text unconditionally told the model to redirect uploaded-file lookups to Knowledge Base, which leaves no path when that tool isn't offered. Soften it to a conditional: prefer Knowledge Base when available, but when it's not, explicitly say listDocuments still can't see uploaded files (separate store) and to check for another file tool instead of refusing outright. Also add regression tests pinning the routing strings on both tools' systemRole prompts, and add the missing vitest.config.mts for builtin-tool-knowledge-base (it had no local test config, so the first test in the package silently ran under the wrong root config).