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
This commit is contained in:
sebastjanartic 2025-09-02 13:23:32 +00:00
parent 1c71b0f6f4
commit 3d303ea68a

View File

@ -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);