From 3d303ea68ac374f4c2c6500cb49cfadbf2962e46 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Tue, 2 Sep 2025 13:23:32 +0000 Subject: [PATCH] Improve AI description generation by automatically saving the output Update the admin page to automatically save the AI-generated video description and provide a confirmation toast message. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 170e18f0-0f13-4eca-8643-546bba1dd8cc Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/170e18f0-0f13-4eca-8643-546bba1dd8cc/LY6xmBI --- client/src/pages/admin.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/client/src/pages/admin.tsx b/client/src/pages/admin.tsx index 5a98aa5..0102fc3 100644 --- a/client/src/pages/admin.tsx +++ b/client/src/pages/admin.tsx @@ -287,13 +287,18 @@ function EditVideoDialog({ if (data && data.description) { console.log("Setting description:", data.description); // Debug log - setFormData(prev => ({ - ...prev, + const newFormData = { + ...formData, description: data.description - })); + }; + setFormData(newFormData); + + // Automatically save the generated description + updateMutation.mutate(newFormData); + toast({ title: "Uspeh!", - description: `AI opis je bil ustvarjen (${data.characterCount || data.description.length}/500 znakov)`, + description: `AI opis je bil ustvarjen in shranjen (${data.characterCount || data.description.length}/500 znakov)`, }); } else { console.error("No description in response:", data);