feat: 主对话仅限管理员访问 + 记忆面板按时间排序与话题关联
- chat_handler.go: HandleWebSocket 新增 admin_ 前缀检查,非管理员返回 403 - index.html: 记忆面板新增时间排序下拉框和话题(会话)列 - renderMemoryResults 拆分为缓存+排序渲染两阶段 - 修复: 修复 typo 'seession_id' -> 'session_id'
This commit is contained in:
@@ -66,6 +66,16 @@ func (h *ChatHandler) HandleWebSocket(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 主对话仅限管理员访问
|
||||
if !strings.HasPrefix(userID, "admin_") {
|
||||
c.JSON(http.StatusForbidden, gin.H{
|
||||
"error": "主对话仅限管理员使用",
|
||||
"errorType": "admin_only",
|
||||
"hint": "请使用管理员账号 (admin_ 前缀) 登录以访问主对话功能",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if sessionID == "" {
|
||||
sessionID = "session_" + generateID()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user