Improve AI video description generation and error handling

Enhance AI video description generation by adding detailed error logging in `aiService.ts` and implementing debug logs within `routes.ts` to track video processing and description generation.

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:10:51 +00:00
parent befb0d2e98
commit d0443dc1b3
2 changed files with 9 additions and 1 deletions

View File

@ -73,8 +73,9 @@ Odgovori samo z opisom, brez dodatnih pojasnil.`;
return description; return description;
} catch (error) { } catch (error: any) {
console.error("Error generating video description:", error); console.error("Error generating video description:", error);
console.error("Error details:", error?.message || error); // More detailed error logging
throw new Error("Napaka pri generiranju opisa s strani AI"); throw new Error("Napaka pri generiranju opisa s strani AI");
} }
} }

View File

@ -1089,12 +1089,17 @@ export async function registerRoutes(app: Express): Promise<Server> {
const videoId = req.params.id; const videoId = req.params.id;
const { maxCharacters = 500, includeArtistInfo = true, includeLabelInfo = true } = req.body; const { maxCharacters = 500, includeArtistInfo = true, includeLabelInfo = true } = req.body;
console.log("AI description request for video:", videoId); // Debug log
// Get video details // Get video details
const video = await storage.getVideo(videoId); const video = await storage.getVideo(videoId);
if (!video) { if (!video) {
console.log("Video not found:", videoId); // Debug log
return res.status(404).json({ message: "Video not found" }); return res.status(404).json({ message: "Video not found" });
} }
console.log("Generating AI description for title:", video.title); // Debug log
// Generate description using AI // Generate description using AI
const description = await generateVideoDescription(video.title, { const description = await generateVideoDescription(video.title, {
maxCharacters, maxCharacters,
@ -1103,6 +1108,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
includeLabelInfo includeLabelInfo
}); });
console.log("Generated description:", description); // Debug log
const result = { const result = {
description, description,
title: video.title, title: video.title,