Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Supports returning a list of files from data snapshots via filename search https://github.com/siyuan-note/siyuan/issues/17258

Daniel95b5c9655a02
diff --git a/app/src/history/history.ts b/app/src/history/history.ts
index 2cad30077c..9ec78ee407 100644
--- a/app/src/history/history.ts
+++ b/app/src/history/history.ts
@@ -276,6 +276,7 @@ const renderRepoSearchResult = (response: IWebSocketData, element: Element) => {
let html = "";
response.data.files.forEach((item: {
fileID: string,
+ indexID: string,
title: string,
hPath: string,
path: string,
@@ -283,7 +284,7 @@ const renderRepoSearchResult = (response: IWebSocketData, element: Element) => {
updated: number
}) => {
/// #if MOBILE
- html += `<li class="b3-list-item" data-type="searchFileItem" data-id="${item.fileID}" data-created="${item.updated}">
+ html += `<li class="b3-list-item" data-type="searchFileItem" data-id="${item.fileID}" data-snapshot="${item.indexID}" data-created="${item.updated}">
<div class="fn__flex-1">
<div style="padding-top:8px" class="b3-list-item__text">${escapeHtml(item.title)}</div>
<div class="b3-list-item__meta">
@@ -311,7 +312,7 @@ const renderRepoSearchResult = (response: IWebSocketData, element: Element) => {
</div>
</li>`;
/// #else
- html += `<li class="b3-list-item b3-list-item--hide-action" data-type="searchFileItem" data-id="${item.fileID}" data-created="${item.updated}">
+ html += `<li class="b3-list-item b3-list-item--hide-action" data-type="searchFileItem" data-id="${item.fileID}" data-snapshot="${item.indexID}" data-created="${item.updated}">
<div class="fn__flex-1">
<span class="b3-list-item__text">${escapeHtml(item.title)}</span>
<div class="b3-list-item__meta">
@@ -744,6 +745,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
break;
} else if (type === "view") {
const liElement = target.closest(".b3-list-item");
+ const snapshotId = liElement.getAttribute("data-snapshot") || "";
const dialog = new Dialog({
title: liElement.querySelector(".b3-list-item__text").textContent.trim(),
content: '<div class="b3-dialog__content"><div style="border-radius: var(--b3-border-radius-b);"></div></div>',
@@ -763,7 +765,7 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
blockId: "",
action: [Constants.CB_GET_HISTORY],
history: {
- snapshot: ""
+ snapshot: snapshotId
},
render: {
background: false,
@@ -774,7 +776,6 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => {
typewriterMode: false
});
disabledProtyle(viewEditor.protyle);
- viewEditor.protyle.options.history.snapshot = ""; // TODO: 88250;
onGet({
data: response,
protyle: viewEditor.protyle,
diff --git a/kernel/go.mod b/kernel/go.mod
index b78f1f31b8..c97db4bbbf 100644
--- a/kernel/go.mod
+++ b/kernel/go.mod
@@ -67,7 +67,7 @@ require (
github.com/sashabaranov/go-openai v1.41.2
github.com/shirou/gopsutil/v4 v4.26.3
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17
- github.com/siyuan-note/dejavu v0.0.0-20260513020519-7bfeed4dabb9
+ github.com/siyuan-note/dejavu v0.0.0-20260528132204-7284248df575
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97
github.com/siyuan-note/filelock v0.0.0-20260411141728-bf44452627c0
diff --git a/kernel/go.sum b/kernel/go.sum
index fa68e531ce..70c8e9d329 100644
--- a/kernel/go.sum
+++ b/kernel/go.sum
@@ -385,8 +385,8 @@ github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05Ut
github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8=
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17 h1:cZbH1QcW/LWYtaKBv2i0O96qVm6HXKeEE3Z74VYdUHM=
github.com/siyuan-note/dataparser v0.0.0-20260115084335-b57cb8bc7c17/go.mod h1:zE2SJ4t+2lFAeLgmhi27YtfzdyOWh3l9DXXUr9m/xU0=
-github.com/siyuan-note/dejavu v0.0.0-20260513020519-7bfeed4dabb9 h1:jhsabdlSjfNlnL33nIDKfgJROgVZQ95GBXG8FT74u6s=
-github.com/siyuan-note/dejavu v0.0.0-20260513020519-7bfeed4dabb9/go.mod h1:Z3rNhHkhbllMLhii0pI2XQDJH9e8MqvteF5LHQ7S9yU=
+github.com/siyuan-note/dejavu v0.0.0-20260528132204-7284248df575 h1:cE+A8DAcC2GqB5CUhrHZc29AsmTBMR7749KXJSojTZM=
+github.com/siyuan-note/dejavu v0.0.0-20260528132204-7284248df575/go.mod h1:Z3rNhHkhbllMLhii0pI2XQDJH9e8MqvteF5LHQ7S9yU=
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f h1:HSgJKIAMgokJDAvBBfRj47SzRSm6mNGssY0Wv7rcEtg=
github.com/siyuan-note/encryption v0.0.0-20251120032857-3ddc3c2cc49f/go.mod h1:JE3S9VuJqTggyfhjesNDuqvqrRvwG3IctFjXXchLx1M=
github.com/siyuan-note/eventbus v0.0.0-20240627125516-396fdb0f0f97 h1:lM5v8BfNtbOL5jYwhCdMYBcYtr06IYBKjjSLAPMKTM8=
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index baf563bb58..5ff7a2e440 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -419,6 +419,7 @@ type LeftRightDiff struct {
type DiffFile struct {
FileID string `json:"fileID"`
+ IndexID string `json:"indexID"`
Title string `json:"title"`
Path string `json:"path"`
HPath string `json:"hPath,omitempty"`
@@ -582,7 +583,7 @@ func SearchRepoFile(keyword string, page int) (ret []*DiffFile, pageCount, total
return
}
- files, totalCount, pageCount, err := repo.SearchFile(keyword, page, 32)
+ files, fileIndexIDs, totalCount, pageCount, err := repo.SearchFile(keyword, page, 32)
if err != nil {
logging.LogErrorf("search repo file failed: %s", err)
return
@@ -607,6 +608,7 @@ func SearchRepoFile(keyword string, page int) (ret []*DiffFile, pageCount, total
}
ret = append(ret, &DiffFile{
FileID: file.ID,
+ IndexID: fileIndexIDs[file.ID],
Title: title,
Path: file.Path,
HPath: hpath,