feat: add web search option to AgentQA functionality

- Introduced a new parameter `webSearchEnabled` to the `AgentQA` method, allowing for conditional web search capabilities.
- Updated the session service interface and handler to accommodate the new parameter, enhancing the flexibility of the AgentQA process.
- Adjusted the configuration to ensure that web search functionality can be toggled based on the provided input.

These changes improve the AgentQA feature by enabling users to control web search integration, enhancing the overall user experience.
This commit is contained in:
wizardchen
2026-03-15 18:17:58 +08:00
parent 9face5920b
commit 6896c7795d
3 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -1371,6 +1371,7 @@ func (s *sessionService) AgentQA(
knowledgeBaseIDs []string,
knowledgeIDs []string,
imageURLs []string, imageDescription string, userMessageID string,
webSearchEnabled bool,
) error {
_ = userMessageID // reserved for future use (AgentQA pipeline differs from KnowledgeQA)
sessionID := session.ID
@@ -1421,7 +1422,7 @@ func (s *sessionService) AgentQA(
MaxIterations: customAgent.Config.MaxIterations,
ReflectionEnabled: customAgent.Config.ReflectionEnabled,
Temperature: customAgent.Config.Temperature,
WebSearchEnabled: customAgent.Config.WebSearchEnabled,
WebSearchEnabled: customAgent.Config.WebSearchEnabled && webSearchEnabled,
WebSearchMaxResults: customAgent.Config.WebSearchMaxResults,
MultiTurnEnabled: customAgent.Config.MultiTurnEnabled,
HistoryTurns: customAgent.Config.HistoryTurns,
+1
View File
@@ -654,6 +654,7 @@ func (h *Handler) executeAgentModeQA(reqCtx *qaRequestContext) {
reqCtx.knowledgeIDs,
imageURLs, imageDescription,
reqCtx.userMessageID,
reqCtx.webSearchEnabled,
)
if err != nil {
logger.ErrorWithFields(streamCtx.asyncCtx, err, nil)
+1
View File
@@ -67,6 +67,7 @@ type SessionService interface {
knowledgeBaseIDs []string,
knowledgeIDs []string,
imageURLs []string, imageDescription string, userMessageID string,
webSearchEnabled bool,
) error
// ClearContext clears the LLM context for a session
ClearContext(ctx context.Context, sessionID string) error