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
+12 -3
View File
@@ -559,6 +559,15 @@ func (h *CustomAgentHandler) GetSuggestedQuestions(c *gin.Context) {
}
}
var tagIDs []string
if tagIDsStr := strings.TrimSpace(c.Query("tag_ids")); tagIDsStr != "" {
for _, id := range strings.Split(tagIDsStr, ",") {
if trimmed := strings.TrimSpace(id); trimmed != "" {
tagIDs = append(tagIDs, trimmed)
}
}
}
limit := 6
if limitStr := c.Query("limit"); limitStr != "" {
if parsed, err := strconv.Atoi(limitStr); err == nil && parsed > 0 {
@@ -566,10 +575,10 @@ func (h *CustomAgentHandler) GetSuggestedQuestions(c *gin.Context) {
}
}
logger.Infof(ctx, "Getting suggested questions for agent %s, kbIDs: %v, limit: %d",
secutils.SanitizeForLog(id), kbIDs, limit)
logger.Infof(ctx, "Getting suggested questions for agent %s, kbIDs: %v, tagIDs: %v, limit: %d",
secutils.SanitizeForLog(id), kbIDs, tagIDs, limit)
questions, err := h.service.GetSuggestedQuestions(ctx, id, kbIDs, knowledgeIDs, limit)
questions, err := h.service.GetSuggestedQuestions(ctx, id, kbIDs, knowledgeIDs, tagIDs, limit)
if err != nil {
logger.ErrorWithFields(ctx, err, map[string]interface{}{
"agent_id": id,