Skip to content

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

:art: fix https://github.com/siyuan-note/siyuan/issues/8141

Vanessabf2d71fe781c
diff --git a/app/src/layout/Model.ts b/app/src/layout/Model.ts
index 4ed9994271..9050f35071 100644
--- a/app/src/layout/Model.ts
+++ b/app/src/layout/Model.ts
@@ -1,10 +1,9 @@
import {Constants} from "../constants";
/// #if !MOBILE
import {Tab} from "./Tab";
-import {exportLayout} from "./util";
/// #endif
import {processMessage} from "../util/processMessage";
-import {kernelError} from "../dialog/processSystem";
+import {kernelError, reloadSync} from "../dialog/processSystem";
export class Model {
public ws: WebSocket;
@@ -17,13 +16,23 @@ export class Model {
/// #endif
- constructor(options: { id: string, type?: TWS, callback?: () => void, msgCallback?: (data: IWebSocketData) => void }) {
+ constructor(options: {
+ id: string,
+ type?: TWS,
+ callback?: () => void,
+ msgCallback?: (data: IWebSocketData) => void
+ }) {
if (options.msgCallback) {
this.connect(options);
}
}
- private connect(options: { id: string, type?: TWS, callback?: () => void, msgCallback?: (data: IWebSocketData) => void }) {
+ private connect(options: {
+ id: string,
+ type?: TWS,
+ callback?: () => void,
+ msgCallback?: (data: IWebSocketData) => void
+ }) {
const websocketURL = `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
const ws = new WebSocket(`${websocketURL}?app=${Constants.SIYUAN_APPID}&id=${options.id}${options.type ? "&type=" + options.type : ""}`);
ws.onopen = () => {
@@ -33,11 +42,13 @@ export class Model {
const logElement = document.getElementById("errorLog");
if (logElement) {
// 内核中断后无法 catch fetch 请求错误,重连会导致无法执行 transactionsTimeout
- /// #if MOBILE
- window.location.reload();
- /// #else
- exportLayout(true);
- /// #endif
+ reloadSync({upsertRootIDs: [], removeRootIDs: []});
+ window.siyuan.dialogs.find(item =>{
+ if (item.element.id === "errorLog") {
+ item.destroy();
+ return true;
+ }
+ });
}
};
ws.onmessage = (event) => {