feat: Enhance agent service and session management with web search capabilities

- Updated AgentConfig to include web search settings, allowing for dynamic configuration of web search features.
- Refactored AgentService to accept SessionService, enabling better management of session-specific web search states.
- Implemented methods in SessionService for handling temporary knowledge base states related to web search.
- Enhanced PluginSearch to utilize SessionService for managing web search state, improving integration with the overall system.
- Updated container setup to ensure proper dependency injection for the new web search service and session management functionalities.
This commit is contained in:
wizardchen
2025-11-11 14:25:20 +08:00
parent 5e0651c26f
commit d2adc38baf
13 changed files with 453 additions and 160 deletions
+9 -1
View File
@@ -2,7 +2,9 @@ package session
import (
"context"
"fmt"
"net/http"
"runtime"
"time"
"github.com/Tencent/WeKnora/internal/errors"
@@ -336,7 +338,13 @@ func (h *Handler) AgentQA(c *gin.Context) {
go func() {
defer func() {
if r := recover(); r != nil {
logger.ErrorWithFields(asyncCtx, errors.NewInternalServerError("Agent QA service panicked"), nil)
buf := make([]byte, 1024)
runtime.Stack(buf, true)
logger.ErrorWithFields(asyncCtx,
errors.NewInternalServerError(fmt.Sprintf("Agent QA service panicked: %v\n%s", r, string(buf))),
map[string]interface{}{
"session_id": sessionID,
})
}
h.completeAssistantMessage(asyncCtx, assistantMessage)
logger.Infof(asyncCtx, "Agent QA service completed for session: %s", sessionID)