Improve handling of automatically generated video descriptions in admin
Update client-side logic in `admin.tsx` to correctly set and process AI-generated descriptions, ensuring type safety for `episodeNumber` and `tags` when updating form data. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/n7jzC7R
This commit is contained in:
parent
289c3c028a
commit
c1fa3898f5
BIN
attached_assets/image_1756822814457.png
Normal file
BIN
attached_assets/image_1756822814457.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@ -320,17 +320,19 @@ function EditVideoDialog({
|
|||||||
|
|
||||||
if (data && data.description) {
|
if (data && data.description) {
|
||||||
console.log("Setting description:", data.description); // Debug log
|
console.log("Setting description:", data.description); // Debug log
|
||||||
const newFormData = {
|
|
||||||
...formData,
|
|
||||||
description: data.description
|
|
||||||
};
|
|
||||||
setFormData(newFormData);
|
|
||||||
|
|
||||||
// Automatically save the generated description with proper type conversion
|
// Update only the description field, keep all other current form data
|
||||||
|
setFormData(prev => ({
|
||||||
|
...prev,
|
||||||
|
description: data.description
|
||||||
|
}));
|
||||||
|
|
||||||
|
// For saving, use current formData but update description
|
||||||
const processedData = {
|
const processedData = {
|
||||||
...newFormData,
|
...formData, // Use current form data
|
||||||
episodeNumber: newFormData.episodeNumber ? parseInt(newFormData.episodeNumber.toString()) : null,
|
description: data.description, // Only update description
|
||||||
tags: Array.isArray(newFormData.tags) ? newFormData.tags : []
|
episodeNumber: formData.episodeNumber ? parseInt(formData.episodeNumber.toString()) : null,
|
||||||
|
tags: Array.isArray(formData.tags) ? formData.tags : []
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save without closing modal for AI generation
|
// Save without closing modal for AI generation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user