Skip to content

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

:art: AI clear context action https://github.com/siyuan-note/siyuan/issues/10255

Daniela85b1d84fb29
diff --git a/kernel/model/ai.go b/kernel/model/ai.go
index 0cdc03e56e..85757f7de1 100644
--- a/kernel/model/ai.go
+++ b/kernel/model/ai.go
@@ -48,6 +48,12 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
var cachedContextMsg []string
func chatGPT(msg string, cloud bool) (ret string) {
+ if "Clear context" == strings.TrimSpace(msg) {
+ // AI clear context action https://github.com/siyuan-note/siyuan/issues/10255
+ cachedContextMsg = nil
+ return
+ }
+
ret, retCtxMsgs, err := chatGPTContinueWrite(msg, cachedContextMsg, cloud)
if nil != err {
return
@@ -58,6 +64,12 @@ func chatGPT(msg string, cloud bool) (ret string) {
func chatGPTWithAction(msg string, action string, cloud bool) (ret string) {
action = strings.TrimSpace(action)
+ if "Clear context" == action {
+ // AI clear context action https://github.com/siyuan-note/siyuan/issues/10255
+ cachedContextMsg = nil
+ return
+ }
+
if "" != action {
msg = action + ":\n\n" + msg
}