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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user