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/3623
Liang Ding72a813277531
diff --git a/kernel/conf/box.go b/kernel/conf/box.goindex 2108c78899..7cfcfcf608 100644--- a/kernel/conf/box.go+++ b/kernel/conf/box.go@@ -16,6 +16,8 @@package conf+import "github.com/siyuan-note/siyuan/kernel/util"+// BoxConf 维护 .siyuan/conf.json 笔记本配置。type BoxConf struct {Name string `json:"name"` // 笔记本名称@@ -26,6 +28,7 @@ type BoxConf struct {DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径+ SortMode int `json:"sortMode"` // 排序方式}func NewBoxConf() *BoxConf {@@ -34,5 +37,6 @@ func NewBoxConf() *BoxConf {Closed: true,DailyNoteSavePath: "/daily note/{{now | date \"2006/01\"}}/{{now | date \"2006-01-02\"}}",DailyNoteTemplatePath: "",+ SortMode: util.SortModeFileTree,}}diff --git a/kernel/model/file.go b/kernel/model/file.goindex 07edca45c2..1483d25d9e 100644--- a/kernel/model/file.go+++ b/kernel/model/file.go@@ -233,6 +233,11 @@ func ListDocTree(boxID, path string, sortMode int) (ret []*File, totals int, errreturn nil, 0, errors.New(Conf.Language(0))}+ boxConf := box.GetConf()+ if util.SortModeFileTree != boxConf.SortMode {+ sortMode = boxConf.SortMode+ }+var files []*FileInfostart := time.Now()files, totals, err = box.Ls(path)diff --git a/kernel/util/sort.go b/kernel/util/sort.goindex a804aabe7a..e87236d4c2 100644--- a/kernel/util/sort.go+++ b/kernel/util/sort.go@@ -68,4 +68,5 @@ const (SortModeSizeDESC // 12:文件大小降序SortModeSubDocCountASC // 13:子文档数升序SortModeSubDocCountDESC // 14:子文档数降序+ SortModeFileTree // 15:使用文档树排序规则)