This commit is contained in:
Liang Ding 2023-03-05 11:27:26 +08:00
parent db636d8b5b
commit 436f487171
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 59 additions and 3 deletions

View file

@ -35,10 +35,22 @@ func chatGPT(c *gin.Context) {
}
msg := arg["msg"].(string)
if "" == util.OpenAIAPIKey {
util.PushMsg(model.Conf.Language(193), 5000)
ret.Data = model.ChatGPT(msg)
}
func chatGPTContinueWriteBlocks(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
ret.Data = util.ChatGPT(msg)
idsArg := arg["ids"].([]interface{})
var ids []string
for _, id := range idsArg {
ids = append(ids, id.(string))
}
ret.Data = model.ChatGPTContinueWriteBlocks(ids)
}