Enhance AI description generation with custom instructions for users

Add a custom instructions input field to the admin video edit dialog and backend to allow users to guide the AI description generation process.

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:18:56 +00:00
parent 6b80ac00c6
commit 15e57c3294
3 changed files with 26 additions and 12 deletions
+18 -8
View File
@@ -229,6 +229,7 @@ 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),
@@ -274,7 +275,8 @@ function EditVideoDialog({
const response = await apiRequest("POST", `/api/admin/videos/${video.id}/generate-description`, {
maxCharacters: 500,
includeArtistInfo: true,
includeLabelInfo: true
includeLabelInfo: true,
customInstructions: customInstructions.trim() || undefined
});
const data = await response.json();
@@ -351,13 +353,21 @@ function EditVideoDialog({
{isGeneratingAI ? "Generating..." : "Generate AI Description"}
</Button>
</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 or use AI to generate one from the title..."
/>
<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>
<div className="text-xs text-white/60 mt-1">
{formData.description.length}/500 characters
</div>