mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-10 03:03:43 +08:00
新增复制按钮图标来复制 ChatGPT 回复内容。Golang 后端实现为每个用户订阅聊天角色功能
This commit is contained in:
@@ -393,6 +393,17 @@ func (s *Server) GetChatHistoryHandle(c *gin.Context) {
|
||||
}
|
||||
|
||||
session := s.ChatSession[sessionId]
|
||||
user, err := GetUser(session.Username)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, types.BizVo{Code: types.Failed, Message: "Invalid args"})
|
||||
return
|
||||
}
|
||||
|
||||
if v, ok := user.ChatRoles[data.Role]; !ok || v != 1 {
|
||||
c.JSON(http.StatusOK, types.BizVo{Code: types.Failed, Message: "No permission to access the history of role " + data.Role})
|
||||
return
|
||||
}
|
||||
|
||||
history, err := GetChatHistory(session.Username, data.Role)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusOK, types.BizVo{Code: types.Failed, Message: "No history message"})
|
||||
|
||||
Reference in New Issue
Block a user