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: Support for opening file history on the doc tree https://github.com/siyuan-note/siyuan/issues/8448
Daniel17d8c79057a3
diff --git a/app/src/history/doc.ts b/app/src/history/doc.tsindex 1a2957b332..3184ef514a 100644--- a/app/src/history/doc.ts+++ b/app/src/history/doc.ts@@ -139,7 +139,7 @@ export const openDocHistory = (options: {event.preventDefault();break;} else if (target.classList.contains("b3-list-item") && !isLoading) {- getHistoryPath(target, opElement.value, options.notebookId, (dataPath) => {+ getHistoryPath(target, opElement.value, options.id, (dataPath) => {fetchPost("/api/history/getDocHistoryContent", {historyPath: dataPath,}, (response) => {diff --git a/kernel/model/history.go b/kernel/model/history.goindex fa6532f5fd..85c7ba4d47 100644--- a/kernel/model/history.go+++ b/kernel/model/history.go@@ -311,20 +311,21 @@ type HistoryItem struct {Path string `json:"path"`}+const fileHistoryPageSize = 32+func FullTextSearchHistory(query, box, op string, typ, page int) (ret []string, pageCount, totalCount int) {query = gulu.Str.RemoveInvisible(query)if "" != query && HistoryTypeDocID != typ {query = stringQuery(query)}- pageSize := 32- offset := (page - 1) * pageSize+ offset := (page - 1) * fileHistoryPageSizetable := "histories_fts_case_insensitive"stmt := "SELECT DISTINCT created FROM " + table + " WHERE "stmt += buildSearchHistoryQueryFilter(query, op, box, table, typ)countStmt := strings.ReplaceAll(stmt, "SELECT DISTINCT created", "SELECT COUNT(DISTINCT created) AS total")- stmt += " ORDER BY created DESC LIMIT " + strconv.Itoa(pageSize) + " OFFSET " + strconv.Itoa(offset)+ stmt += " ORDER BY created DESC LIMIT " + strconv.Itoa(fileHistoryPageSize) + " OFFSET " + strconv.Itoa(offset)result, err := sql.QueryHistory(stmt)if nil != err {return@@ -343,20 +344,20 @@ func FullTextSearchHistory(query, box, op string, typ, page int) (ret []string,return}totalCount = int(result[0]["total"].(int64))- pageCount = int(math.Ceil(float64(totalCount) / float64(pageSize)))+ pageCount = int(math.Ceil(float64(totalCount) / float64(fileHistoryPageSize)))return}func FullTextSearchHistoryItems(created, query, box, op string, typ int) (ret []*HistoryItem) {query = gulu.Str.RemoveInvisible(query)- if "" != query {+ if "" != query && HistoryTypeDocID != typ {query = stringQuery(query)}table := "histories_fts_case_insensitive"stmt := "SELECT * FROM " + table + " WHERE "stmt += buildSearchHistoryQueryFilter(query, op, box, table, typ)- stmt += " AND created = '" + created + "' ORDER BY created DESC LIMIT " + fmt.Sprintf("%d", Conf.Search.Limit)+ stmt += " AND created = '" + created + "' ORDER BY created DESC LIMIT " + fmt.Sprintf("%d", fileHistoryPageSize)sqlHistories := sql.SelectHistoriesRawStmt(stmt)ret = fromSQLHistories(sqlHistories)return