Add Image Generation from Prompts: Implement new functionality to generate images from prompts, including backend processing, API integration, and frontend handling with progress modal. Update settings and registry for new AI function.
This commit is contained in:
@@ -73,7 +73,8 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
|
||||
}
|
||||
return 'Article drafted successfully.';
|
||||
}
|
||||
if (funcName.includes('image')) {
|
||||
if (funcName.includes('image') && (funcName.includes('prompt') || funcName.includes('extract'))) {
|
||||
// Image prompt generation
|
||||
// Try to extract from SAVE step message first (most reliable)
|
||||
const saveStepLog = stepLogs?.find(log => log.stepName === 'SAVE');
|
||||
if (saveStepLog?.message) {
|
||||
@@ -119,6 +120,13 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
|
||||
|
||||
// Default message
|
||||
return 'Featured Image and X In‑article Image Prompts ready for image generation';
|
||||
} else if (funcName.includes('image') && funcName.includes('from')) {
|
||||
// Image generation from prompts
|
||||
const imageCount = extractCount(/(\d+)\s+image/i, stepLogs || []);
|
||||
if (imageCount) {
|
||||
return `${imageCount} image${imageCount !== '1' ? 's' : ''} generated successfully`;
|
||||
}
|
||||
return 'Images generated successfully';
|
||||
}
|
||||
return 'Task completed successfully.';
|
||||
};
|
||||
@@ -157,7 +165,8 @@ const getStepsForFunction = (functionId?: string, title?: string): Array<{phase:
|
||||
];
|
||||
}
|
||||
|
||||
if (funcName.includes('image')) {
|
||||
if (funcName.includes('image') && (funcName.includes('prompt') || funcName.includes('extract'))) {
|
||||
// Image prompt generation
|
||||
return [
|
||||
{ phase: 'INIT', label: 'Checking content and image slots' },
|
||||
{ phase: 'PREP', label: 'Mapping Content for X Image Prompts' },
|
||||
@@ -165,6 +174,15 @@ const getStepsForFunction = (functionId?: string, title?: string): Array<{phase:
|
||||
{ phase: 'PARSE', label: 'Writing X In‑article Image Prompts' },
|
||||
{ phase: 'SAVE', label: 'Assigning Prompts to Dedicated Slots' },
|
||||
];
|
||||
} else if (funcName.includes('image') && funcName.includes('from')) {
|
||||
// Image generation from prompts
|
||||
return [
|
||||
{ phase: 'INIT', label: 'Validating image prompts' },
|
||||
{ phase: 'PREP', label: 'Preparing image generation queue' },
|
||||
{ phase: 'AI_CALL', label: 'Generating images with AI' },
|
||||
{ phase: 'PARSE', label: 'Processing image URLs' },
|
||||
{ phase: 'SAVE', label: 'Saving image URLs' },
|
||||
];
|
||||
}
|
||||
|
||||
// Default fallback
|
||||
|
||||
Reference in New Issue
Block a user