feat(chat): add @Skill/@MCP mentions with scoped agent runtime

Wire per-turn @mentions for skills, MCP services, tags, and files through
QA handlers into agent config, runtime_context/must_use user blocks, and
tool registration. Fix tag-only scopes dropping KB tools, refresh suggested
questions on mention changes, and strengthen MCP must_use so @selected
services are invoked before local KB search.
This commit is contained in:
wizardchen
2026-06-29 16:01:58 +08:00
committed by lyingbug
parent 40f217c228
commit 049f85139d
44 changed files with 1814 additions and 378 deletions
+5 -2
View File
@@ -1917,6 +1917,7 @@ func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {
"success": true,
"data": []interface{}{},
"has_more": false,
"total": 0,
})
return
}
@@ -1958,7 +1959,7 @@ func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {
agentID, removed)
}
}
knowledges, hasMore, err := h.kgService.SearchKnowledgeForScopes(ctx, scopes, keyword, offset, limit, fileTypes)
knowledges, hasMore, total, err := h.kgService.SearchKnowledgeForScopes(ctx, scopes, keyword, offset, limit, fileTypes)
if err != nil {
logger.ErrorWithFields(ctx, err, nil)
c.Error(errors.NewInternalServerError("Failed to search knowledge").WithDetails(err.Error()))
@@ -1968,12 +1969,13 @@ func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {
"success": true,
"data": knowledges,
"has_more": hasMore,
"total": total,
})
return
}
// Default: own + shared KBs
knowledges, hasMore, err := h.kgService.SearchKnowledge(ctx, keyword, offset, limit, fileTypes)
knowledges, hasMore, total, err := h.kgService.SearchKnowledge(ctx, keyword, offset, limit, fileTypes)
if err != nil {
logger.ErrorWithFields(ctx, err, nil)
c.Error(errors.NewInternalServerError("Failed to search knowledge").WithDetails(err.Error()))
@@ -1984,6 +1986,7 @@ func (h *KnowledgeHandler) SearchKnowledge(c *gin.Context) {
"success": true,
"data": knowledges,
"has_more": hasMore,
"total": total,
})
}