fix(agent-share): don't require rerank model for wiki-only agents

The share-time validation forced every agent bound to a knowledge base to
have a rerank model configured, which blocked Wiki-type agents
(`wiki_search` / `wiki_read_page` / …) from being shared even though they
never invoke the reranker at runtime.

Align the check with the runtime logic in `session_agent_qa.go`: only
require a rerank model when the agent's allowed_tools include
`knowledge_search` (or rely on the default tool set, which contains it).
Wiki-only agents can now be shared without a rerank model; hybrid / RAG
agents still enforce the requirement.

Also update the handler error message to reflect the new rule.
This commit is contained in:
wizardchen
2026-04-24 10:09:13 +08:00
committed by lyingbug
parent 220404348e
commit b8c45b173e
2 changed files with 34 additions and 5 deletions
+1 -1
View File
@@ -1262,7 +1262,7 @@ func (h *OrganizationHandler) ShareAgent(c *gin.Context) {
return
}
if errors.Is(err, service.ErrAgentNotConfigured) {
c.Error(apperrors.NewValidationError("Agent is not fully configured. Please set the chat model and, if using knowledge bases, the rerank model in agent settings."))
c.Error(apperrors.NewValidationError("Agent is not fully configured. Please set the chat model, and set the rerank model if the knowledge_search tool is enabled in agent settings."))
return
}
c.Error(apperrors.NewForbiddenError("Permission denied or invalid operation"))