优化登录逻辑

This commit is contained in:
RockYang
2023-04-08 10:57:46 +08:00
parent df9e587300
commit 208655af5e
5 changed files with 80 additions and 17 deletions

View File

@@ -299,8 +299,8 @@ func (s *Server) ListApiKeysHandle(c *gin.Context) {
// GetChatRoleListHandle 获取聊天角色列表
func (s *Server) GetChatRoleListHandle(c *gin.Context) {
var rolesOrder = []string{"gpt", "programmer", "teacher", "red_book", "dou_yin", "weekly_report", "girl_friend",
"kong_zi", "lu_xun", "steve_jobs", "elon_musk", "translator", "english_trainer",
var rolesOrder = []string{"gpt", "teacher", "translator", "english_trainer", "weekly_report", "girl_friend",
"kong_zi", "lu_xun", "steve_jobs", "elon_musk", "red_book", "dou_yin", "programmer",
"seller", "good_comment", "psychiatrist", "artist"}
var res = make([]interface{}, 0)
var roles = GetChatRoles()

View File

@@ -302,5 +302,8 @@ func (s *Server) LoginHandle(c *gin.Context) {
return
}
c.JSON(http.StatusOK, types.BizVo{Code: types.Success, Data: sessionId})
c.JSON(http.StatusOK, types.BizVo{Code: types.Success, Data: struct {
User types.User `json:"user"`
SessionId string `json:"session_id"`
}{User: *user, SessionId: sessionId}})
}