🎨 OpenAI API 接入增加环境变量 SIYUAN_OPENAI_API_BASE_URL

This commit is contained in:
Liang Ding 2023-03-08 20:00:17 +08:00
parent 1c9e0356cc
commit a8129de5f5
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 18 additions and 11 deletions

View file

@ -27,26 +27,20 @@ import (
)
func ChatGPT(msg string) (ret string) {
cloud := IsSubscriber()
if !cloud && !isOpenAIAPIEnabled() {
if !isOpenAIAPIEnabled() {
return
}
cloud = false
return chatGPT(msg, cloud)
return chatGPT(msg, false)
}
func ChatGPTWithAction(ids []string, action string) (ret string) {
cloud := IsSubscriber()
if !cloud && !isOpenAIAPIEnabled() {
if !isOpenAIAPIEnabled() {
return
}
cloud = false
msg := getBlocksContent(ids)
ret = chatGPTWithAction(msg, action, cloud)
ret = chatGPTWithAction(msg, action, false)
return
}