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')