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

View file

@ -17,11 +17,11 @@
package api
import (
"github.com/siyuan-note/siyuan/kernel/model"
"net/http"
"github.com/88250/gulu"
"github.com/gin-gonic/gin"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
)

View file

@ -24,6 +24,11 @@ import (
)
func ChatGPTContinueWriteBlocks(ids []string) (ret string) {
if "" == util.OpenAIAPIKey {
util.PushMsg(Conf.Language(193), 5000)
return
}
sqlBlocks := sql.GetBlocks(ids)
buf := bytes.Buffer{}
@ -37,5 +42,10 @@ func ChatGPTContinueWriteBlocks(ids []string) (ret string) {
return
}
func ChatGPT(msg string) (ret string) {
if "" == util.OpenAIAPIKey {
util.PushMsg(Conf.Language(193), 5000)
return
}
return util.ChatGPT(msg)
}

View file

@ -19,7 +19,6 @@ package util
import (
"bytes"
"context"
"github.com/siyuan-note/siyuan/kernel/model"
"net/http"
"net/url"
"os"
@ -48,7 +47,6 @@ func ChatGPT(msg string) (ret string) {
func ChatGPTContinueWrite(msg string, contextMsgs []string) (ret string, retContextMsgs []string) {
if "" == OpenAIAPIKey {
PushMsg(model.Conf.Language(193), 5000)
return
}