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 Ding2b0788db6ca3
diff --git a/kernel/model/box.go b/kernel/model/box.goindex d1f5b99ce7..4335c9c763 100644--- a/kernel/model/box.go+++ b/kernel/model/box.go@@ -20,8 +20,6 @@ import ("bytes""errors""fmt"- "github.com/siyuan-note/siyuan/kernel/task"- "io/ioutil""os""path""path/filepath"@@ -41,17 +39,19 @@ import ("github.com/siyuan-note/logging""github.com/siyuan-note/siyuan/kernel/conf""github.com/siyuan-note/siyuan/kernel/sql"+ "github.com/siyuan-note/siyuan/kernel/task""github.com/siyuan-note/siyuan/kernel/treenode""github.com/siyuan-note/siyuan/kernel/util")// Box 笔记本。type Box struct {- ID string `json:"id"`- Name string `json:"name"`- Icon string `json:"icon"`- Sort int `json:"sort"`- Closed bool `json:"closed"`+ ID string `json:"id"`+ Name string `json:"name"`+ Icon string `json:"icon"`+ Sort int `json:"sort"`+ SortMode int `json:"sortMode"`+ Closed bool `json:"closed"`historyGenerated int64 // 最近一次历史生成时间}@@ -123,11 +123,12 @@ func ListNotebooks() (ret []*Box, err error) {id := dir.Name()ret = append(ret, &Box{- ID: id,- Name: boxConf.Name,- Icon: boxConf.Icon,- Sort: boxConf.Sort,- Closed: boxConf.Closed,+ ID: id,+ Name: boxConf.Name,+ Icon: boxConf.Icon,+ Sort: boxConf.Sort,+ SortMode: boxConf.SortMode,+ Closed: boxConf.Closed,})}@@ -226,12 +227,18 @@ func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error) {}}- files, err := ioutil.ReadDir(filepath.Join(util.DataDir, box.ID, p))+ entries, err := os.ReadDir(filepath.Join(util.DataDir, box.ID, p))if nil != err {return}- for _, f := range files {+ for _, f := range entries {+ info, infoErr := f.Info()+ if nil != infoErr {+ logging.LogErrorf("read file info failed: %s", infoErr)+ continue+ }+name := f.Name()if util.IsReservedFilename(name) {continue@@ -246,7 +253,7 @@ func (box *Box) Ls(p string) (ret []*FileInfo, totals int, err error) {fi := &FileInfo{}fi.name = namefi.isdir = f.IsDir()- fi.size = f.Size()+ fi.size = info.Size()fPath := path.Join(p, name)if f.IsDir() {fPath += "/"