Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 块级加入 `人工智能` https://github.com/siyuan-note/siyuan/issues/7566

Liang Dingba400854b0a1
diff --git a/kernel/model/ai.go b/kernel/model/ai.go
index d82a7ab772..de3f1872a4 100644
--- a/kernel/model/ai.go
+++ b/kernel/model/ai.go
@@ -24,8 +24,7 @@ import (
)
func ChatGPTContinueWriteBlocks(ids []string) (ret string) {
- if "" == util.OpenAIAPIKey {
- util.PushMsg(Conf.Language(193), 5000)
+ if !isOpenAIAPIEnabled() {
return
}
@@ -41,11 +40,19 @@ func ChatGPTContinueWriteBlocks(ids []string) (ret string) {
ret, _ = util.ChatGPTContinueWrite(msg, nil)
return
}
+
func ChatGPT(msg string) (ret string) {
- if "" == util.OpenAIAPIKey {
- util.PushMsg(Conf.Language(193), 5000)
+ if !isOpenAIAPIEnabled() {
return
}
return util.ChatGPT(msg)
}
+
+func isOpenAIAPIEnabled() bool {
+ if "" == util.OpenAIAPIKey {
+ util.PushMsg(Conf.Language(193), 5000)
+ return false
+ }
+ return true
+}