From 38941ff2b54488bf55eebcf789994420c9c05ee7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Apr 2026 13:47:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20sql.js=20Uint8Array?= =?UTF-8?q?=20=E4=B8=8E=20fs.writeFile=20=E7=9A=84=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sql.js export() 返回 Uint8Array,需用 Buffer.from() 转换后再写入文件 解决潜在的类型不匹配错误 --- ts/src/runtime/core/graph_memory/graph_database.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/src/runtime/core/graph_memory/graph_database.ts b/ts/src/runtime/core/graph_memory/graph_database.ts index d52e01a..3b0caf2 100644 --- a/ts/src/runtime/core/graph_memory/graph_database.ts +++ b/ts/src/runtime/core/graph_memory/graph_database.ts @@ -54,7 +54,8 @@ export class GraphDatabase { await fs.mkdir(dir, true); } const data = this.db.export(); - await fs.writeFile(dbPath, data.buffer as ArrayBuffer, { encoding: 'binary' }); + // sql.js returns Uint8Array, convert to Buffer for writeFile compatibility + await fs.writeFile(dbPath, Buffer.from(data), { encoding: 'binary' }); } catch (error) { console.error(`[GraphDatabase] Save failed: ${error}`); }