Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/15818

Vanessa9fdfa27682d2
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index da248e5610..564b5597be 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -258,7 +258,7 @@ export class Plugin {
this.setting.open(this.displayName || this.name);
}
- public loadData(storageName: string) {
+ public loadData(storageName: string): Promise<IWebSocketData> {
if (typeof this.data[storageName] === "undefined") {
this.data[storageName] = "";
}
@@ -274,7 +274,7 @@ export class Plugin {
});
}
- public saveData(storageName: string, data: any) {
+ public saveData(storageName: string, data: any): Promise<any | IWebSocketData> {
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
return Promise.reject({
code: 403,
@@ -312,7 +312,7 @@ export class Plugin {
});
}
- public removeData(storageName: string) {
+ public removeData(storageName: string): Promise<IWebSocketData> {
if (window.siyuan.config.readonly || window.siyuan.isPublish) {
return Promise.reject({
code: 403,
diff --git a/app/src/util/fetch.ts b/app/src/util/fetch.ts
index ece58ee616..caf6f1a218 100644
--- a/app/src/util/fetch.ts
+++ b/app/src/util/fetch.ts
@@ -93,6 +93,14 @@ export const fetchPost = (
cb(response);
}
}).catch((e) => {
+ if (failCallback && url === "/api/file/getFile") {
+ failCallback({
+ data: null,
+ msg: e.message,
+ code: 400,
+ });
+ return;
+ }
console.warn("fetch post failed [" + e + "], url [" + url + "]");
if (url === "/api/transactions" && (e.message === "Failed to fetch" || e.message === "Unexpected end of JSON input")) {
kernelError();