image promtp ang progress modal texts
This commit is contained in:
@@ -74,15 +74,51 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
|
||||
return 'Article drafted successfully.';
|
||||
}
|
||||
if (funcName.includes('image')) {
|
||||
const imageCount = extractCount(/(\d+)\s+image/i, stepLogs || []);
|
||||
const taskCount = extractCount(/(\d+)\s+task/i, stepLogs || []);
|
||||
|
||||
if (imageCount) {
|
||||
return `Images created successfully — ${imageCount} image${imageCount !== '1' ? 's' : ''} generated.`;
|
||||
} else if (taskCount) {
|
||||
return `Images created successfully — ${taskCount} task${taskCount !== '1' ? 's' : ''} completed.`;
|
||||
// Try to extract from SAVE step message first (most reliable)
|
||||
const saveStepLog = stepLogs?.find(log => log.stepName === 'SAVE');
|
||||
if (saveStepLog?.message) {
|
||||
// Look for "Assigning X Prompts to Dedicated Slots"
|
||||
const countMatch = saveStepLog.message.match(/Assigning (\d+)\s+Prompts/i);
|
||||
if (countMatch) {
|
||||
const totalPrompts = parseInt(countMatch[1], 10);
|
||||
const inArticleCount = totalPrompts > 1 ? totalPrompts - 1 : 0;
|
||||
if (inArticleCount > 0) {
|
||||
return `Featured Image and ${inArticleCount} In‑article Image Prompts ready for image generation`;
|
||||
} else {
|
||||
return `Featured Image Prompt ready for image generation`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'Images created and saved successfully.';
|
||||
|
||||
// Try to extract from PREP step to get total count
|
||||
const prepStepLog = stepLogs?.find(log => log.stepName === 'PREP');
|
||||
if (prepStepLog?.message) {
|
||||
const match = prepStepLog.message.match(/Mapping Content for (\d+)\s+Image Prompts/i);
|
||||
if (match && match[1]) {
|
||||
const totalPrompts = parseInt(match[1], 10);
|
||||
const inArticleCount = totalPrompts > 1 ? totalPrompts - 1 : 0;
|
||||
if (inArticleCount > 0) {
|
||||
return `Featured Image and ${inArticleCount} In‑article Image Prompts ready for image generation`;
|
||||
} else {
|
||||
return `Featured Image Prompt ready for image generation`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: extract prompt count from any step log
|
||||
const promptCount = extractCount(/(\d+)\s+prompt/i, stepLogs || []);
|
||||
if (promptCount) {
|
||||
const totalPrompts = parseInt(promptCount, 10);
|
||||
const inArticleCount = totalPrompts > 1 ? totalPrompts - 1 : 0;
|
||||
if (inArticleCount > 0) {
|
||||
return `Featured Image and ${inArticleCount} In‑article Image Prompts ready for image generation`;
|
||||
} else {
|
||||
return `Featured Image Prompt ready for image generation`;
|
||||
}
|
||||
}
|
||||
|
||||
// Default message
|
||||
return 'Featured Image and X In‑article Image Prompts ready for image generation';
|
||||
}
|
||||
return 'Task completed successfully.';
|
||||
};
|
||||
@@ -123,11 +159,11 @@ const getStepsForFunction = (functionId?: string, title?: string): Array<{phase:
|
||||
|
||||
if (funcName.includes('image')) {
|
||||
return [
|
||||
{ phase: 'INIT', label: 'Validating task' },
|
||||
{ phase: 'PREP', label: 'Extracting image prompts' },
|
||||
{ phase: 'AI_CALL', label: 'Creating images with Igny8 Semantic AI' },
|
||||
{ phase: 'PARSE', label: 'Processing images' },
|
||||
{ phase: 'SAVE', label: 'Saving images' },
|
||||
{ phase: 'INIT', label: 'Checking content and image slots' },
|
||||
{ phase: 'PREP', label: 'Mapping Content for X Image Prompts' },
|
||||
{ phase: 'AI_CALL', label: 'Writing Featured Image Prompts' },
|
||||
{ phase: 'PARSE', label: 'Writing X In‑article Image Prompts' },
|
||||
{ phase: 'SAVE', label: 'Assigning Prompts to Dedicated Slots' },
|
||||
];
|
||||
}
|
||||
|
||||
@@ -337,14 +373,53 @@ export default function ProgressModal({
|
||||
}
|
||||
}
|
||||
} else if (funcName.includes('image')) {
|
||||
if (stepPhase === 'AI_CALL') {
|
||||
// For AI_CALL: Show "Creating images with Igny8 Semantic AI"
|
||||
return 'Creating images with Igny8 Semantic AI';
|
||||
} else if (stepPhase === 'PARSE') {
|
||||
const imageCount = extractCount(/(\d+)\s+image/i);
|
||||
if (imageCount) {
|
||||
return `${imageCount} image${imageCount !== '1' ? 's' : ''} created`;
|
||||
if (stepPhase === 'PREP') {
|
||||
// Extract total image count from PREP step message
|
||||
// Look for "Mapping Content for X Image Prompts"
|
||||
const totalCount = extractCount(/(\d+)\s+Image Prompts/i) || extractCount(/(\d+)\s+image/i);
|
||||
if (totalCount) {
|
||||
return `Mapping Content for ${totalCount} Image Prompts`;
|
||||
}
|
||||
// Try to extract from step log message
|
||||
if (stepLog?.message) {
|
||||
const match = stepLog.message.match(/Mapping Content for (\d+)\s+Image Prompts/i);
|
||||
if (match && match[1]) {
|
||||
return `Mapping Content for ${match[1]} Image Prompts`;
|
||||
}
|
||||
}
|
||||
return 'Mapping Content for X Image Prompts';
|
||||
} else if (stepPhase === 'AI_CALL') {
|
||||
// For AI_CALL: Show "Writing Featured Image Prompts"
|
||||
return 'Writing Featured Image Prompts';
|
||||
} else if (stepPhase === 'PARSE') {
|
||||
// Extract in-article image count from PARSE step
|
||||
// Look for "Writing X In‑article Image Prompts"
|
||||
const inArticleCount = extractCount(/(\d+)\s+In‑article/i) || extractCount(/(\d+)\s+In-article/i);
|
||||
if (inArticleCount) {
|
||||
return `Writing ${inArticleCount} In‑article Image Prompts`;
|
||||
}
|
||||
// Try to extract from step log message
|
||||
if (stepLog?.message) {
|
||||
const match = stepLog.message.match(/Writing (\d+)\s+In[‑-]article Image Prompts/i);
|
||||
if (match && match[1]) {
|
||||
return `Writing ${match[1]} In‑article Image Prompts`;
|
||||
}
|
||||
}
|
||||
return 'Writing X In‑article Image Prompts';
|
||||
} else if (stepPhase === 'SAVE') {
|
||||
// For SAVE: Extract prompt count from message
|
||||
const promptCount = extractCount(/(\d+)\s+Prompts/i) || extractCount(/(\d+)\s+prompt/i);
|
||||
if (promptCount) {
|
||||
return `Assigning ${promptCount} Prompts to Dedicated Slots`;
|
||||
}
|
||||
// Try to extract from step log message
|
||||
if (stepLog?.message) {
|
||||
const match = stepLog.message.match(/Assigning (\d+)\s+Prompts/i);
|
||||
if (match && match[1]) {
|
||||
return `Assigning ${match[1]} Prompts to Dedicated Slots`;
|
||||
}
|
||||
}
|
||||
return 'Assigning Prompts to Dedicated Slots';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,10 +588,25 @@ export default function ProgressModal({
|
||||
} else if (funcName.includes('idea')) {
|
||||
// For idea generation, use fixed heading
|
||||
return 'Generating Content Ideas & Outline';
|
||||
} else if (funcName.includes('image')) {
|
||||
// For image prompts, use fixed heading
|
||||
return 'Smart Image Prompts';
|
||||
}
|
||||
return title;
|
||||
})()}
|
||||
</h3>
|
||||
{/* Subtitle for image prompts */}
|
||||
{(() => {
|
||||
const funcName = (functionId || title || '').toLowerCase();
|
||||
if (funcName.includes('image')) {
|
||||
return (
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400 text-center mt-1">
|
||||
Powered by Igny8 Visual Intelligence
|
||||
</p>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
{!showSuccess && status !== 'completed' && (
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 text-center">{message}</p>
|
||||
)}
|
||||
|
||||
@@ -161,7 +161,7 @@ export default function Content() {
|
||||
// Open progress modal for async task
|
||||
progressModal.openModal(
|
||||
result.task_id,
|
||||
'Generate Image Prompts',
|
||||
'Smart Image Prompts',
|
||||
'ai-generate-image-prompts-01-desktop'
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user