重构了memory.ts,增加了文件写入锁,解决了并行写入导致记忆文件错误的问题; (#4671)

优化了memory.json文件的加载过程,只加载一次,其它涉及图谱的操作均在内存中完成,提高效率;
注意新引入了async-mutex软件包,需要yarn install安装。
This commit is contained in:
robot-AI 2025-04-11 22:03:57 +08:00 committed by GitHub
parent 04333535dd
commit 7c39116351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 516 additions and 366 deletions

View File

@ -73,6 +73,7 @@
"@types/react-infinite-scroll-component": "^5.0.0",
"@xyflow/react": "^12.4.4",
"adm-zip": "^0.5.16",
"async-mutex": "^0.5.0",
"color": "^5.0.0",
"diff": "^7.0.0",
"docx": "^9.0.2",

File diff suppressed because it is too large Load Diff

View File

@ -3942,6 +3942,7 @@ __metadata:
analytics: "npm:^0.8.16"
antd: "npm:^5.22.5"
applescript: "npm:^1.0.0"
async-mutex: "npm:^0.5.0"
axios: "npm:^1.7.3"
babel-plugin-styled-components: "npm:^2.1.4"
browser-image-compression: "npm:^2.0.2"
@ -4477,6 +4478,15 @@ __metadata:
languageName: node
linkType: hard
"async-mutex@npm:^0.5.0":
version: 0.5.0
resolution: "async-mutex@npm:0.5.0"
dependencies:
tslib: "npm:^2.4.0"
checksum: 10c0/9096e6ad6b674c894d8ddd5aa4c512b09bb05931b8746ebd634952b05685608b2b0820ed5c406e6569919ff5fe237ab3c491e6f2887d6da6b6ba906db3ee9c32
languageName: node
linkType: hard
"async@npm:^3.2.3":
version: 3.2.6
resolution: "async@npm:3.2.6"