An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: https://github.com/siyuan-note/siyuan/issues/16463
Daniela65f46c922ed
diff --git a/kernel/model/file.go b/kernel/model/file.goindex de0bf09f78..5e1f3c2abf 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1074,6 +1074,8 @@ func CreateWithMarkdown(tags, boxID, hPath, md, parentID, id string, withMath boreturn}+const DailyNoteAttrPrefix = "custom-dailynote-"+func CreateDailyNote(boxID string) (p string, existed bool, err error) {createDocLock.Lock()defer createDocLock.Unlock()@@ -1110,8 +1112,8 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {}p = tree.Pathdate := time.Now().Format("20060102")- if tree.Root.IALAttr("custom-dailynote-"+date) == "" {- tree.Root.SetIALAttr("custom-dailynote-"+date, date)+ if tree.Root.IALAttr(DailyNoteAttrPrefix+date) == "" {+ tree.Root.SetIALAttr(DailyNoteAttrPrefix+date, date)if err = indexWriteTreeUpsertQueue(tree); err != nil {return}@@ -1179,7 +1181,7 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {}p = tree.Pathdate := time.Now().Format("20060102")- tree.Root.SetIALAttr("custom-dailynote-"+date, date)+ tree.Root.SetIALAttr(DailyNoteAttrPrefix+date, date)if err = indexWriteTreeUpsertQueue(tree); err != nil {return}diff --git a/kernel/model/graph.go b/kernel/model/graph.goindex 515f01d13c..f051a98184 100644--- a/kernel/model/graph.go+++ b/kernel/model/graph.go@@ -126,17 +126,17 @@ func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links [refBlocks := fromSQLBlocks(&sqlRefBs, "", 0)if 0 < len(dailyNotesPaths) {- filterDailyNote := false+ isDailyNote := falsevar tmp []*Blockfor _, refBlock := range refBlocks {for _, dailyNotePath := range dailyNotesPaths {if strings.HasPrefix(refBlock.HPath, dailyNotePath) {- filterDailyNote = true+ isDailyNote = truebreak}}- if !filterDailyNote {+ if !isDailyNote {tmp = append(tmp, refBlock)}}@@ -149,6 +149,7 @@ func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links [}}+ blocks = filterDailyNote(blocks, true)genTreeNodes(blocks, &nodes, &links, true)growTreeGraph(&forwardlinks, &backlinks, &nodes)blocks = append(blocks, forwardlinks...)@@ -187,6 +188,7 @@ func BuildGraph(query string) (boxID string, nodes []*GraphNode, links []*GraphLsqlBlocks := sql.GetAllChildBlocks(rootIDs, stmt, Conf.Graph.MaxBlocks)treeBlocks := fromSQLBlocks(&sqlBlocks, "", 0)+ treeBlocks = filterDailyNote(treeBlocks, false)genTreeNodes(treeBlocks, &nodes, &links, false)blocks = append(blocks, treeBlocks...)@@ -598,6 +600,34 @@ func graphTypeFilter(local bool) string {return " AND ref.type IN (" + strings.Join(inList, ",") + ")"}+func filterDailyNote(blocks []*Block, local bool) (ret []*Block) {+ // Graph dailynote filtering not working https://github.com/siyuan-note/siyuan/issues/16463++ dailyNote := Conf.Graph.Local.DailyNote+ if !local {+ dailyNote = Conf.Graph.Global.DailyNote+ }++ if dailyNote {+ ret = blocks+ return+ }++ for _, block := range blocks {+ isDailyNote := false+ for k, _ := range block.IAL {+ isDailyNote = strings.HasPrefix(k, DailyNoteAttrPrefix)+ if isDailyNote {+ break+ }+ }+ if !isDailyNote {+ ret = append(ret, block)+ }+ }+ return+}+func graphDailyNoteFilter(local bool) string {dailyNotesPaths := dailyNotePaths(local)if 1 > len(dailyNotesPaths) {