mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-18 06:35:27 +01:00
This commit is contained in:
parent
db636d8b5b
commit
436f487171
4 changed files with 59 additions and 3 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -329,4 +329,5 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/av/renderAttributeView", model.CheckAuth, renderAttributeView)
|
||||
|
||||
ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, chatGPT)
|
||||
ginServer.Handle("POST", "/api/ai/chatGPTContinueWriteBlocks", model.CheckAuth, chatGPTContinueWriteBlocks)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue