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/10884

Danielde0b64f8caae
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index 0d258f42a3..0bdd1f45d7 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -1312,10 +1312,15 @@ func (tx *Transaction) commit() (err error) {
if err = writeJSONQueue(tree); nil != err {
return
}
+
+ var sources []interface{}
+ for _, op := range tx.DoOperations {
+ sources = append(sources, op.Action)
+ }
+ util.PushSaveDoc(tree.ID, "tx", sources)
}
refreshDynamicRefTexts(tx.nodes, tx.trees)
IncSync()
- tx.trees = nil
tx.state.Store(2)
tx.m.Unlock()
return
diff --git a/kernel/util/websocket.go b/kernel/util/websocket.go
index 8643b776e8..9cae9cd4c6 100644
--- a/kernel/util/websocket.go
+++ b/kernel/util/websocket.go
@@ -220,6 +220,15 @@ func PushReloadDoc(rootID string) {
BroadcastByType("main", "reloaddoc", 0, "", rootID)
}
+func PushSaveDoc(rootID, typ string, sources interface{}) {
+ data := map[string]interface{}{
+ "rootID": rootID,
+ "type": typ,
+ "sources": sources,
+ }
+ BroadcastByType("main", "savedoc", 0, "", data)
+}
+
func PushProtyleReload(rootID string) {
BroadcastByType("protyle", "reload", 0, "", rootID)
}