Improve AI description generation for video content and fix errors

Update the AI description generation process to correctly handle and display AI-generated descriptions in the admin interface, including error handling and success notifications.

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:09:04 +00:00
parent e948249a96
commit 7b2008baff
3 changed files with 24 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -263,12 +263,27 @@ function EditVideoDialog({
includeArtistInfo: true,
includeLabelInfo: true
});
const data = await response.json();
if (response.description) {
setFormData(prev => ({ ...prev, description: response.description }));
console.log("AI Response:", data); // Debug log
if (data && data.description) {
console.log("Setting description:", data.description); // Debug log
setFormData(prev => ({
...prev,
description: data.description
}));
toast({
title: "Success",
description: `AI description generated (${response.characterCount}/${response.maxCharacters} characters)`,
title: "Uspeh!",
description: `AI opis je bil ustvarjen (${data.characterCount || data.description.length}/500 znakov)`,
});
} else {
console.error("No description in response:", data);
toast({
title: "Napaka",
description: "AI ni vrnil opisa",
variant: "destructive",
});
}
} catch (error: any) {

View File

@ -1103,12 +1103,15 @@ export async function registerRoutes(app: Express): Promise<Server> {
includeLabelInfo
});
res.json({
const result = {
description,
title: video.title,
characterCount: description.length,
maxCharacters
});
};
console.log("Sending AI response:", result); // Debug log
res.json(result);
} catch (error) {
console.error("Error generating AI description:", error);