fix: config error

This commit is contained in:
ikechan8370 2025-04-10 12:56:48 +08:00
parent 3c83e270df
commit 6b36552c08

View file

@ -264,10 +264,13 @@ class ChatGPTConfig {
// 避免在代理对象保存时再次触发
if (!target.__isSaving) {
target.__isSaving = true
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')