From 8564a03a111be4e20375f52946d028dee37cc838 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Wed, 3 Jun 2026 11:40:38 +0800 Subject: [PATCH] :sparkles: AI Agent panel https://github.com/siyuan-note/siyuan/issues/17797 Signed-off-by: Daniel <845765@qq.com> --- app/src/layout/dock/SessionStore.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/app/src/layout/dock/SessionStore.ts b/app/src/layout/dock/SessionStore.ts index f0736c278..1b88b4dd6 100644 --- a/app/src/layout/dock/SessionStore.ts +++ b/app/src/layout/dock/SessionStore.ts @@ -22,26 +22,17 @@ function newSessionId(): string { return (window as any).Lute ? (window as any).Lute.NewNodeID() : Date.now().toString(36); } -async function readTextFile(path: string): Promise { +async function readJsonFile(path: string): Promise { try { var r = await fetchSyncPost("/api/file/getFile", {path: path}) as any; - console.log("[SS] getFile full response:", JSON.stringify(r)); - if (!r || r.code !== 0 || !r.data || r.data === null) { - return null; - } - return r.data; + // getFile 返回的是文件内容本身,不是 {code, data} 包装 + if (!r) { return null; } + return r; } catch (e) { - console.log("[SS] readText error:", path, e); return null; } } -async function readJsonFile(path: string): Promise { - var text = await readTextFile(path); - if (!text) { console.log("[SS] readJson null, path:", path); return null; } - try { return JSON.parse(text); } catch (e) { console.log("[SS] readJson parse err:", path, e); return null; } -} - async function writeJsonFile(path: string, data: any): Promise { var content = JSON.stringify(data, null, 2); var fileName = path.split("/").pop() || "file.json";