feat: 增强会话管理和 Agent 服务

- 优化 session_handler 会话处理逻辑
- 增强 agent_service Agent 服务功能
- 新增 chat_repository 仓储方法
- 更新 agent_handler 和 chat_group_handler
- 更新数据模型 agent 和 chat_session

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 19:49:27 +08:00
parent bce8b9240b
commit 31f0feafb5
8 changed files with 146 additions and 30 deletions

View File

@@ -377,7 +377,7 @@ func main() {
toolService := service.NewToolService(toolRepo)
mcpService := service.NewMCPService(mcpRepo)
skillService := service.NewSkillService(skillRepo)
agentService := service.NewAgentService(cfg.PythonServiceURL, modelRepo, agentRepo)
agentService := service.NewAgentService(cfg.PythonServiceURL, modelRepo, agentRepo, chatRepo)
memoryService := service.NewMemoryService(agentRepo)
// 4.2 初始化默认工具
@@ -407,7 +407,7 @@ func main() {
skillHandler := handler.NewSkillHandler(skillService)
agentHandler := handler.NewAgentHandler(agentService)
memoryHandler := handler.NewMemoryHandler(memoryService)
sessionHandler := handler.NewSessionHandler(chatRepo)
sessionHandler := handler.NewSessionHandler(chatRepo, agentService)
// 初始化群聊服务
chatGroupRepo := repository.NewChatGroupRepository(db)
@@ -608,6 +608,7 @@ func main() {
chatGroup.DELETE("/sessions/:id", sessionHandler.DeleteSession)
chatGroup.GET("/sessions/:id/messages", sessionHandler.GetMessages)
chatGroup.POST("/messages", sessionHandler.CreateMessage)
chatGroup.POST("/sessions/generate-title", sessionHandler.GenerateSessionTitle)
}
// 群聊管理模块