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 Dingc214a38eb918
diff --git a/kernel/model/ai.go b/kernel/model/ai.go
index a2f7592634..df9b33b02f 100644
--- a/kernel/model/ai.go
+++ b/kernel/model/ai.go
@@ -31,7 +31,7 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
}
msg := getBlocksContent(ids)
- ret = util.ChatGPTWithAction(msg, action, Conf.Lang)
+ ret = util.ChatGPTWithAction(msg, action)
return
}
@@ -81,10 +81,11 @@ func getBlocksContent(ids []string) string {
}
}
+ luteEngine := util.NewLute()
buf := bytes.Buffer{}
for _, node := range nodes {
- content := treenode.NodeStaticContent(node, nil, true)
- buf.WriteString(content)
+ md := treenode.ExportNodeStdMd(node, luteEngine)
+ buf.WriteString(md)
buf.WriteString("\n\n")
}
return buf.String()
diff --git a/kernel/util/openai.go b/kernel/util/openai.go
index 2ee9bddfbc..6a13690b61 100644
--- a/kernel/util/openai.go
+++ b/kernel/util/openai.go
@@ -45,11 +45,8 @@ func ChatGPT(msg string) (ret string) {
return
}
-func ChatGPTWithAction(msg string, action string, lang string) (ret string) {
- prompt := "{action} as follows, the result is in {lang}:\n"
- prompt = strings.Replace(prompt, "{action}", action, -1)
- prompt = strings.Replace(prompt, "{lang}", lang, -1)
- msg = prompt + msg
+func ChatGPTWithAction(msg string, action string) (ret string) {
+ msg = action + ":\n\n" + msg
ret, _ = ChatGPTContinueWrite(msg, nil)
return
}