From 2b9c8fbc5b0d519ab1436369849e1fe44039bfe7 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 25 Oct 2025 10:47:04 +0200 Subject: [PATCH] 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 --- main.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.ts b/main.ts index 06039b2..528f30a 100644 --- a/main.ts +++ b/main.ts @@ -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(); } }