An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: 数据历史每页最后一条记录时间异常 Fix https://github.com/siyuan-note/siyuan/issues/6455
Liang Dingbe6380cbf7f3
diff --git a/kernel/model/history.go b/kernel/model/history.goindex 78d735e6fb..653ef894a3 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -317,8 +317,7 @@ func FullTextSearchHistory(query, box, op string, typ, page int) (ret []*History}pageSize := 32- from := (page - 1) * pageSize- to := page * pageSize+ offset := (page - 1) * pageSizetable := "histories_fts_case_insensitive"stmt := "SELECT * FROM " + table + " WHERE "@@ -341,7 +340,7 @@ func FullTextSearchHistory(query, box, op string, typ, page int) (ret []*Historystmt += " AND path LIKE '%/assets/%'"}countStmt := strings.ReplaceAll(stmt, "SELECT *", "SELECT COUNT(*) AS total")- stmt += " ORDER BY created DESC LIMIT " + strconv.Itoa(from) + ", " + strconv.Itoa(to)+ stmt += " ORDER BY created DESC LIMIT " + strconv.Itoa(pageSize) + " OFFSET " + strconv.Itoa(offset)sqlHistories := sql.SelectHistoriesRawStmt(stmt)ret = fromSQLHistories(sqlHistories)result, err := sql.QueryHistory(countStmt)@@ -660,12 +659,9 @@ func fromSQLHistories(sqlHistories []*sql.History) (ret []*History) {}var items []*HistoryItem- var tmpTime int64+ tmpTime, _ := strconv.ParseInt(sqlHistories[0].Created, 10, 64)for _, sqlHistory := range sqlHistories {unixSec, _ := strconv.ParseInt(sqlHistory.Created, 10, 64)- if 0 == tmpTime {- tmpTime = unixSec- }if tmpTime == unixSec {item := &HistoryItem{Title: sqlHistory.Title,@@ -691,6 +687,7 @@ func fromSQLHistories(sqlHistories []*sql.History) (ret []*History) {items = []*HistoryItem{}items = append(items, item)}+ tmpTime = unixSec}if 0 < len(items) {ret = append(ret, &History{