Prevents cross-key model cache leakage

Clears model cache when API key changes to ensure accurate model list access

Prevents potential issues with stale model entitlements when switching API keys programmatically
This commit is contained in:
AlexKucera committed 2025-10-25 10:47:04 +02:00
1 parent 1c1cba6ce5
commit 2b9c8fbc5b
1 file changed
+3
+3
View File
@@ -135,6 +135,9 @@ export default class FreewritingPromptsPlugin extends Plugin {
if (this.promptGenerator && this.lastApiKey !== this.settings.apiKey) {
this.promptGenerator.updateApiKey(this.settings.apiKey);
this.lastApiKey = this.settings.apiKey;
// Clear model cache to ensure model list reflects new account entitlements
// This prevents cross-key cache leakage if settings are changed programmatically
this.modelService?.clearCache();
}
}