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

Danielb375208ab801
diff --git a/kernel/model/ai.go b/kernel/model/ai.go
index 85757f7de1..97308bf9d6 100644
--- a/kernel/model/ai.go
+++ b/kernel/model/ai.go
@@ -40,6 +40,12 @@ func ChatGPTWithAction(ids []string, action string) (ret string) {
return
}
+ if "Clear context" == action {
+ // AI clear context action https://github.com/siyuan-note/siyuan/issues/10255
+ cachedContextMsg = nil
+ return
+ }
+
msg := getBlocksContent(ids)
ret = chatGPTWithAction(msg, action, false)
return
@@ -64,12 +70,6 @@ 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
}