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: 当自定义排序时支持在文档上/下新建同级文档 https://github.com/siyuan-note/siyuan/issues/5098
Liang Dingb40b460f0c27
diff --git a/kernel/api/filetree.go b/kernel/api/filetree.goindex e292f5d2f0..0b3f8f3baa 100644--- a/kernel/api/filetree.go+++ b/kernel/api/filetree.go@@ -342,8 +342,15 @@ func createDoc(c *gin.Context) {p := arg["path"].(string)title := arg["title"].(string)md := arg["md"].(string)+ sortsArg := arg["sorts"]+ var sorts []string+ if nil != sortsArg {+ for _, sort := range sortsArg.([]interface{}) {+ sorts = append(sorts, sort.(string))+ }+ }- err := model.CreateDocByMd(notebook, p, title, md)+ err := model.CreateDocByMd(notebook, p, title, md, sorts)if nil != err {ret.Code = -1ret.Msg = err.Error()diff --git a/kernel/model/file.go b/kernel/model/file.goindex ccc7714027..c89ed3b752 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -920,7 +920,7 @@ func DuplicateDoc(rootID string) (err error) {return}-func CreateDocByMd(boxID, p, title, md string) (err error) {+func CreateDocByMd(boxID, p, title, md string, sorts []string) (err error) {WaitForWritingFiles()box := Conf.Box(boxID)@@ -930,7 +930,13 @@ func CreateDocByMd(boxID, p, title, md string) (err error) {luteEngine := NewLute()dom := luteEngine.Md2BlockDOM(md)- return createDoc(box.ID, p, title, dom)+ err = createDoc(box.ID, p, title, dom)+ if nil != err {+ return+ }++ ChangeFileTreeSort(box.ID, sorts)+ return}func CreateWithMarkdown(boxID, hPath, md string) (id string, err error) {