mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-23 15:08:13 +02:00
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
This commit is contained in:
1 parent
8a40860afa
commit
dec97ca71e
1 file changed
+11
-4
@@ -79,12 +79,19 @@ export default function Settings() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const saveOpenrouterMutation = useMutation({
|
const saveOpenrouterMutation = useMutation({
|
||||||
mutationFn: () =>
|
mutationFn: () => {
|
||||||
apiRequest('POST', '/api/openrouter/config', {
|
const payload: any = {
|
||||||
apiKey: openrouterApiKey,
|
|
||||||
model: openrouterModel,
|
model: openrouterModel,
|
||||||
systemPrompt: openrouterSystemPrompt,
|
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: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['/api/openrouter/config'] });
|
queryClient.invalidateQueries({ queryKey: ['/api/openrouter/config'] });
|
||||||
toast({
|
toast({
|
||||||
|
|||||||
Reference in new issue
Block a user