添加聊天角色支持

This commit is contained in:
RockYang
2023-03-24 18:14:40 +08:00
parent 967ca441d7
commit 43b7191ffa
5 changed files with 74 additions and 39 deletions

View File

@@ -151,5 +151,15 @@ func (s *Server) ListApiKeys(c *gin.Context) {
}
func (s *Server) GetChatRoles(c *gin.Context) {
c.JSON(http.StatusOK, types.BizVo{Code: types.Success, Message: types.OkMsg, Data: s.Config.ChatRoles})
var roles = make(map[string]interface{})
for k, v := range s.Config.ChatRoles {
roles[k] = struct {
Key string `json:"key"`
Name string `json:"name"`
}{
Key: v.Key,
Name: v.Name,
}
}
c.JSON(http.StatusOK, types.BizVo{Code: types.Success, Message: types.OkMsg, Data: roles})
}