feat: Update agent type presets and prompt templates for improved knowledge base handling

- Changed `kb_selection_mode` in agent type presets from "selected" to "all" to allow agents to access all knowledge bases by default.
- Revised prompt templates to clarify the handling of bound knowledge bases, replacing the `{{knowledge_bases}}` placeholder with a reference to the `<bound_knowledge_bases>` block in the user message's `<runtime_context>`.
- Enhanced internal logic to ensure that only searchable knowledge bases are considered during retrieval, improving the efficiency of knowledge searches.
- Added new functions for better formatting and handling of knowledge base metadata in the runtime context.
- Updated documentation and comments for clarity on the changes made to knowledge base interactions.
This commit is contained in:
wizardchen
2026-04-22 21:17:12 +08:00
parent 11e0c4c65f
commit 50c1c70334
9 changed files with 191 additions and 66 deletions
+4 -2
View File
@@ -129,12 +129,14 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args json.RawMessage)
return
}
// Use knowledge's actual tenant_id for chunk query (supports cross-tenant shared KB)
// Use knowledge's actual tenant_id for chunk query (supports cross-tenant shared KB).
// Keep chunk-type filter aligned with list_knowledge_chunks so the
// "chunk_count" reported here matches what that tool can page over.
_, total, err := t.chunkService.GetRepository().
ListPagedChunksByKnowledgeID(ctx, knowledge.TenantID, id, &types.Pagination{
Page: 1,
PageSize: 1,
}, []types.ChunkType{"text"}, "", "", "", "", "")
}, []types.ChunkType{types.ChunkTypeText, types.ChunkTypeFAQ}, "", "", "", "", "")
if err != nil {
mu.Lock()
results[id] = &docInfo{