An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: Refactor create doc by hpath
Daniele74733b4e1af
diff --git a/kernel/model/file.go b/kernel/model/file.goindex 9a16518251..1be997f731 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -1038,7 +1038,7 @@ func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (retID string, erWaitForWritingFiles()luteEngine := util.NewLute()dom := luteEngine.Md2BlockDOM(md, false)- retID, _, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)+ retID, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)return}@@ -1442,7 +1442,7 @@ func CreateDailyNote(boxID string) (p string, existed bool, err error) {return}- id, existed, err := createDocsByHPath(box.ID, hPath, "", "", "")+ id, err := createDocsByHPath(box.ID, hPath, "", "", "")if nil != err {return}diff --git a/kernel/model/path.go b/kernel/model/path.goindex da18ea3360..48edfc9a60 100644--- a/kernel/model/path.go+++ b/kernel/model/path.go@@ -33,7 +33,7 @@ import ("github.com/siyuan-note/siyuan/kernel/util")-func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数仅在 parentID 不为空的情况下使用 */) (retID string, existed bool, err error) {+func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数仅在 parentID 不为空的情况下使用 */) (retID string, err error) {hPath = strings.TrimSuffix(hPath, ".sy")pathBuilder := bytes.Buffer{}pathBuilder.WriteString("/")@@ -62,6 +62,12 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数}}+ root := treenode.GetBlockTreeRootByPath(boxID, hPath)+ if nil != root {+ retID = root.ID+ return+ }+parts := strings.Split(hPath, "/")[1:]for i, part := range parts {hPathBuilder.WriteString(part)