This commit is contained in:
Liang Ding 2023-03-06 14:28:16 +08:00
parent 4d6129de7b
commit c214a38eb9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 6 additions and 8 deletions

View file

@ -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()

View file

@ -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
}