fix(core): shallow-clone savedApiKeySource to avoid mutation risk

Copy the ConfigSource object before applyResolvedModelDefaults runs,
so a future refactor that mutates source objects in place won't break
the save/restore logic.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
jinye.djy 2026-04-26 00:44:41 +08:00
parent 0e3cb0a753
commit 7b628d7003

View file

@ -905,6 +905,8 @@ export class ModelsConfig {
: undefined; : undefined;
const savedApiKeySource = isUnchanged const savedApiKeySource = isUnchanged
? this.generationConfigSources['apiKey'] ? this.generationConfigSources['apiKey']
? { ...this.generationConfigSources['apiKey'] }
: undefined
: undefined; : undefined;
this.applyResolvedModelDefaults(resolved); this.applyResolvedModelDefaults(resolved);