An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Improve doc dynamic loading
Daniel57f9c4ddc1da
diff --git a/kernel/model/file.go b/kernel/model/file.goindex 8c7e7fac2d..2f12a7f950 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -681,6 +681,19 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[sif 1 > len(nodes) {// 按 mode 加载兜底nodes, eof = loadNodesByMode(node, inputIndex, mode, size, isDoc, isHeading)+ } else {+ // 文档块没有指定 index 时需要计算 index,否则初次打开文档时 node-index 会为 0,导致首次 Ctrl+Home 无法回到顶部+ ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {+ if !entering {+ return ast.WalkContinue+ }++ index+++ if nodes[0].ID == n.ID {+ return ast.WalkStop+ }+ return ast.WalkContinue+ })}} else {nodes, eof = loadNodesByMode(node, inputIndex, mode, size, isDoc, isHeading)