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:
@@ -31,12 +31,18 @@ func (h *ChatGroupHandler) CreateGroup(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 从上下文获取用户ID
|
||||
// 从上下文获取用户ID,如果存在则覆盖请求中的user_id
|
||||
userID, exists := c.Get("user_id")
|
||||
if exists {
|
||||
req.UserID = userID.(string)
|
||||
}
|
||||
|
||||
// 验证user_id
|
||||
if req.UserID == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "user_id is required"})
|
||||
return
|
||||
}
|
||||
|
||||
group, err := h.groupService.CreateGroup(req)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
|
||||
Reference in New Issue
Block a user