Skip to content

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

:art: Ctrl+N should follow notebook create save path https://ld246.com/article/1695965429553

Daniel2b9bec8e8b07
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.go
index 3377a4a5be..0d879dbe99 100644
--- a/kernel/api/filetree.go
+++ b/kernel/api/filetree.go
@@ -503,7 +503,7 @@ func createDocWithMd(c *gin.Context) {
hPath = "/" + hPath
}
- err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, id)
+ id, err := model.CreateWithMarkdown(notebook, hPath, markdown, parentID, id)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
diff --git a/kernel/model/file.go b/kernel/model/file.go
index a73877716d..9a16518251 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -1028,7 +1028,7 @@ func CreateDocByMd(boxID, p, title, md string, sorts []string) (tree *parse.Tree
return
}
-func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (err error) {
+func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (retID string, err error) {
box := Conf.Box(boxID)
if nil == box {
err = errors.New(Conf.Language(0))
@@ -1038,7 +1038,7 @@ func CreateWithMarkdown(boxID, hPath, md, parentID, id string) (err error) {
WaitForWritingFiles()
luteEngine := util.NewLute()
dom := luteEngine.Md2BlockDOM(md, false)
- _, _, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
+ retID, _, err = createDocsByHPath(box.ID, hPath, dom, parentID, id)
return
}