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
+6 -8
View File
@@ -112,20 +112,18 @@ func BuildContainer(container *dig.Container) *dig.Container {
must(container.Provide(service.NewMessageService))
must(container.Provide(service.NewMCPServiceService))
// Agent service layer (requires event bus)
// Web search service (needed by AgentService)
must(container.Provide(service.NewWebSearchService))
// Agent service layer (requires event bus, web search service)
// SessionService is passed as parameter to CreateAgentEngine method when creating AgentService
must(container.Provide(event.NewEventBus))
must(container.Provide(service.NewAgentService))
// Session service (depends on agent service)
// SessionService is created after AgentService and passes itself to AgentService.CreateAgentEngine when needed
must(container.Provide(service.NewSessionService))
// Web search service
must(container.Provide(service.NewWebSearchService))
// Register WebSearchService as interface for dependency injection
must(container.Provide(func(ws *service.WebSearchService) interfaces.WebSearchService {
return ws
}))
// Chat pipeline components for processing chat requests
must(container.Provide(chatpipline.NewEventManager))
// Ensure Async task components are registered before invoking plugins that depend on KnowledgeService