Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve creating doc

Daniel4f2148e3b683
diff --git a/kernel/model/path.go b/kernel/model/path.go
index 5a6c138659..4ce251c81e 100644
--- a/kernel/model/path.go
+++ b/kernel/model/path.go
@@ -57,12 +57,6 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string, titleEmpty bo
}
}
- root := treenode.GetBlockTreeRootByPath(boxID, hPath)
- if nil != root {
- retID = root.ID
- return
- }
-
hPathBuilder := bytes.Buffer{}
hpathBtMap := map[string]*treenode.BlockTree{}
parts := strings.Split(hPath, "/")[1:]
@@ -76,7 +70,7 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string, titleEmpty bo
hPathBuilder.WriteString("/")
hPathBuilder.WriteString(part)
hp := hPathBuilder.String()
- root = treenode.GetBlockTreeRootByHPath(boxID, hp)
+ root := treenode.GetBlockTreeRootByHPath(boxID, hp)
if nil == root {
break
}
@@ -91,7 +85,7 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string, titleEmpty bo
for i, part := range parts {
hPathBuilder.WriteString(part)
hp := hPathBuilder.String()
- root = hpathBtMap[hp]
+ root := hpathBtMap[hp]
isNotLast := i < len(parts)-1
if nil == root {
rootID := ast.NewNodeID()