Improve AI description generation by using existing description as instructions

Refactor EditVideoDialog to use the description field for custom AI generation instructions and consolidate input fields.

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:19:50 +00:00
parent 15e57c3294
commit 1c71b0f6f4

View File

@ -229,7 +229,6 @@ function EditVideoDialog({
});
}, [video]);
const [isGeneratingAI, setIsGeneratingAI] = useState(false);
const [customInstructions, setCustomInstructions] = useState("");
const updateMutation = useMutation({
mutationFn: (data: any) => apiRequest("PATCH", `/api/admin/videos/${video.id}`, data),
@ -270,13 +269,16 @@ function EditVideoDialog({
return;
}
// Use description field content as custom instructions
const instructions = formData.description.trim();
setIsGeneratingAI(true);
try {
const response = await apiRequest("POST", `/api/admin/videos/${video.id}/generate-description`, {
maxCharacters: 500,
includeArtistInfo: true,
includeLabelInfo: true,
customInstructions: customInstructions.trim() || undefined
customInstructions: instructions || undefined
});
const data = await response.json();
@ -353,21 +355,13 @@ function EditVideoDialog({
{isGeneratingAI ? "Generating..." : "Generate AI Description"}
</Button>
</div>
<div className="space-y-2">
<Input
placeholder="AI instructions (e.g., 'mention band members', 'focus on song history')..."
value={customInstructions}
onChange={(e) => setCustomInstructions(e.target.value)}
className="bg-white/10 border-white/20 text-white placeholder:text-white/50 text-sm"
/>
<Textarea
value={formData.description}
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
className="bg-white/10 border-white/20 text-white min-h-[100px]"
rows={3}
placeholder="Enter description or use AI to generate one from the title..."
/>
</div>
<Textarea
value={formData.description}
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
className="bg-white/10 border-white/20 text-white min-h-[100px]"
rows={3}
placeholder="Enter description manually or type AI instructions (e.g., 'mention band members', 'focus on song history') and click Generate AI Description..."
/>
<div className="text-xs text-white/60 mt-1">
{formData.description.length}/500 characters
</div>