From dec97ca71ece5868d68453c8081af7654f7cefb9 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 2 Oct 2025 07:28:46 +0000 Subject: [PATCH 1/2] Fix issue with saving AI model selection in settings Update `saveOpenrouterMutation` in `client/src/pages/settings.tsx` to conditionally include `apiKey` in the payload only if it's not empty, resolving the bug where AI model selection was not persisting. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/4KAFpKS --- client/src/pages/settings.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/pages/settings.tsx b/client/src/pages/settings.tsx index d1bcf1a..ee5287f 100644 --- a/client/src/pages/settings.tsx +++ b/client/src/pages/settings.tsx @@ -79,12 +79,19 @@ export default function Settings() { }); const saveOpenrouterMutation = useMutation({ - mutationFn: () => - apiRequest('POST', '/api/openrouter/config', { - apiKey: openrouterApiKey, + mutationFn: () => { + const payload: any = { model: openrouterModel, systemPrompt: openrouterSystemPrompt, - }), + }; + + // N'inclure apiKey que s'il n'est pas vide + if (openrouterApiKey && openrouterApiKey.trim() !== "") { + payload.apiKey = openrouterApiKey; + } + + return apiRequest('POST', '/api/openrouter/config', payload); + }, onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['/api/openrouter/config'] }); toast({ From 657598ff2b4b396106aa15a610e2fd8871908c70 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Thu, 2 Oct 2025 07:29:06 +0000 Subject: [PATCH 2/2] Fix issue where AI model selection resets to default Resolve bug preventing persistence of user-selected AI models in production environment. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/4KAFpKS