mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
4d6129de7b
commit
c214a38eb9
2 changed files with 6 additions and 8 deletions
|
|
@ -31,7 +31,7 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := getBlocksContent(ids)
|
msg := getBlocksContent(ids)
|
||||||
ret = util.ChatGPTWithAction(msg, action, Conf.Lang)
|
ret = util.ChatGPTWithAction(msg, action)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,10 +81,11 @@ func getBlocksContent(ids []string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
luteEngine := util.NewLute()
|
||||||
buf := bytes.Buffer{}
|
buf := bytes.Buffer{}
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
content := treenode.NodeStaticContent(node, nil, true)
|
md := treenode.ExportNodeStdMd(node, luteEngine)
|
||||||
buf.WriteString(content)
|
buf.WriteString(md)
|
||||||
buf.WriteString("\n\n")
|
buf.WriteString("\n\n")
|
||||||
}
|
}
|
||||||
return buf.String()
|
return buf.String()
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,8 @@ func ChatGPT(msg string) (ret string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func ChatGPTWithAction(msg string, action string, lang string) (ret string) {
|
func ChatGPTWithAction(msg string, action string) (ret string) {
|
||||||
prompt := "{action} as follows, the result is in {lang}:\n"
|
msg = action + ":\n\n" + msg
|
||||||
prompt = strings.Replace(prompt, "{action}", action, -1)
|
|
||||||
prompt = strings.Replace(prompt, "{lang}", lang, -1)
|
|
||||||
msg = prompt + msg
|
|
||||||
ret, _ = ChatGPTContinueWrite(msg, nil)
|
ret, _ = ChatGPTContinueWrite(msg, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue