From 6b36552c0880a1178bf5d89b1bace50f10d28483 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Thu, 10 Apr 2025 12:56:48 +0800 Subject: [PATCH] fix: config error --- config/config.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/config.js b/config/config.js index 2109bd4..0127577 100644 --- a/config/config.js +++ b/config/config.js @@ -264,8 +264,11 @@ class ChatGPTConfig { // 避免在代理对象保存时再次触发 if (!target.__isSaving) { target.__isSaving = true - this.saveToFile() - target.__isSaving = false + try { + this.saveToFile() + } finally { + target.__isSaving = false + } } } return true @@ -287,6 +290,7 @@ class ChatGPTConfig { * Load config from file */ loadFromFile () { + this.__isSaving = false; try { const content = fs.readFileSync(this.configPath, 'utf8') const loadedConfig = this.configPath.endsWith('.json')