image promtp ang progress modal texts
This commit is contained in:
@@ -70,6 +70,17 @@ class AIEngine:
|
|||||||
return f"Preparing {count} content idea{'s' if count != 1 else ''}"
|
return f"Preparing {count} content idea{'s' if count != 1 else ''}"
|
||||||
elif function_name == 'generate_images':
|
elif function_name == 'generate_images':
|
||||||
return f"Extracting image prompts from {count} task{'s' if count != 1 else ''}"
|
return f"Extracting image prompts from {count} task{'s' if count != 1 else ''}"
|
||||||
|
elif function_name == 'generate_image_prompts':
|
||||||
|
# Extract max_images from data if available
|
||||||
|
if isinstance(data, list) and len(data) > 0:
|
||||||
|
max_images = data[0].get('max_images', 2)
|
||||||
|
total_images = 1 + max_images # 1 featured + max_images in-article
|
||||||
|
return f"Mapping Content for {total_images} Image Prompts"
|
||||||
|
elif isinstance(data, dict) and 'max_images' in data:
|
||||||
|
max_images = data.get('max_images', 2)
|
||||||
|
total_images = 1 + max_images
|
||||||
|
return f"Mapping Content for {total_images} Image Prompts"
|
||||||
|
return f"Mapping Content for Image Prompts"
|
||||||
return f"Preparing {count} item{'s' if count != 1 else ''}"
|
return f"Preparing {count} item{'s' if count != 1 else ''}"
|
||||||
|
|
||||||
def _get_ai_call_message(self, function_name: str, count: int) -> str:
|
def _get_ai_call_message(self, function_name: str, count: int) -> str:
|
||||||
@@ -106,6 +117,12 @@ class AIEngine:
|
|||||||
return f"{count} article{'s' if count != 1 else ''} created"
|
return f"{count} article{'s' if count != 1 else ''} created"
|
||||||
elif function_name == 'generate_images':
|
elif function_name == 'generate_images':
|
||||||
return f"{count} image{'s' if count != 1 else ''} created"
|
return f"{count} image{'s' if count != 1 else ''} created"
|
||||||
|
elif function_name == 'generate_image_prompts':
|
||||||
|
# Count is total prompts, in-article is count - 1 (subtract featured)
|
||||||
|
in_article_count = max(0, count - 1)
|
||||||
|
if in_article_count > 0:
|
||||||
|
return f"Writing {in_article_count} In‑article Image Prompts"
|
||||||
|
return "Writing In‑article Image Prompts"
|
||||||
return f"{count} item{'s' if count != 1 else ''} processed"
|
return f"{count} item{'s' if count != 1 else ''} processed"
|
||||||
|
|
||||||
def _get_save_message(self, function_name: str, count: int) -> str:
|
def _get_save_message(self, function_name: str, count: int) -> str:
|
||||||
@@ -118,6 +135,9 @@ class AIEngine:
|
|||||||
return f"Saving {count} article{'s' if count != 1 else ''}"
|
return f"Saving {count} article{'s' if count != 1 else ''}"
|
||||||
elif function_name == 'generate_images':
|
elif function_name == 'generate_images':
|
||||||
return f"Saving {count} image{'s' if count != 1 else ''}"
|
return f"Saving {count} image{'s' if count != 1 else ''}"
|
||||||
|
elif function_name == 'generate_image_prompts':
|
||||||
|
# Count is total prompts created
|
||||||
|
return f"Assigning {count} Prompts to Dedicated Slots"
|
||||||
return f"Saving {count} item{'s' if count != 1 else ''}"
|
return f"Saving {count} item{'s' if count != 1 else ''}"
|
||||||
|
|
||||||
def execute(self, fn: BaseAIFunction, payload: dict) -> dict:
|
def execute(self, fn: BaseAIFunction, payload: dict) -> dict:
|
||||||
|
|||||||
@@ -74,15 +74,51 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
|
|||||||
return 'Article drafted successfully.';
|
return 'Article drafted successfully.';
|
||||||
}
|
}
|
||||||
if (funcName.includes('image')) {
|
if (funcName.includes('image')) {
|
||||||
const imageCount = extractCount(/(\d+)\s+image/i, stepLogs || []);
|
// Try to extract from SAVE step message first (most reliable)
|
||||||
const taskCount = extractCount(/(\d+)\s+task/i, stepLogs || []);
|
const saveStepLog = stepLogs?.find(log => log.stepName === 'SAVE');
|
||||||
|
if (saveStepLog?.message) {
|
||||||
if (imageCount) {
|
// Look for "Assigning X Prompts to Dedicated Slots"
|
||||||
return `Images created successfully — ${imageCount} image${imageCount !== '1' ? 's' : ''} generated.`;
|
const countMatch = saveStepLog.message.match(/Assigning (\d+)\s+Prompts/i);
|
||||||
} else if (taskCount) {
|
if (countMatch) {
|
||||||
return `Images created successfully — ${taskCount} task${taskCount !== '1' ? 's' : ''} completed.`;
|
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.';
|
return 'Task completed successfully.';
|
||||||
};
|
};
|
||||||
@@ -123,11 +159,11 @@ const getStepsForFunction = (functionId?: string, title?: string): Array<{phase:
|
|||||||
|
|
||||||
if (funcName.includes('image')) {
|
if (funcName.includes('image')) {
|
||||||
return [
|
return [
|
||||||
{ phase: 'INIT', label: 'Validating task' },
|
{ phase: 'INIT', label: 'Checking content and image slots' },
|
||||||
{ phase: 'PREP', label: 'Extracting image prompts' },
|
{ phase: 'PREP', label: 'Mapping Content for X Image Prompts' },
|
||||||
{ phase: 'AI_CALL', label: 'Creating images with Igny8 Semantic AI' },
|
{ phase: 'AI_CALL', label: 'Writing Featured Image Prompts' },
|
||||||
{ phase: 'PARSE', label: 'Processing images' },
|
{ phase: 'PARSE', label: 'Writing X In‑article Image Prompts' },
|
||||||
{ phase: 'SAVE', label: 'Saving images' },
|
{ phase: 'SAVE', label: 'Assigning Prompts to Dedicated Slots' },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,14 +373,53 @@ export default function ProgressModal({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (funcName.includes('image')) {
|
} else if (funcName.includes('image')) {
|
||||||
if (stepPhase === 'AI_CALL') {
|
if (stepPhase === 'PREP') {
|
||||||
// For AI_CALL: Show "Creating images with Igny8 Semantic AI"
|
// Extract total image count from PREP step message
|
||||||
return 'Creating images with Igny8 Semantic AI';
|
// Look for "Mapping Content for X Image Prompts"
|
||||||
} else if (stepPhase === 'PARSE') {
|
const totalCount = extractCount(/(\d+)\s+Image Prompts/i) || extractCount(/(\d+)\s+image/i);
|
||||||
const imageCount = extractCount(/(\d+)\s+image/i);
|
if (totalCount) {
|
||||||
if (imageCount) {
|
return `Mapping Content for ${totalCount} Image Prompts`;
|
||||||
return `${imageCount} image${imageCount !== '1' ? 's' : ''} created`;
|
|
||||||
}
|
}
|
||||||
|
// 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')) {
|
} else if (funcName.includes('idea')) {
|
||||||
// For idea generation, use fixed heading
|
// For idea generation, use fixed heading
|
||||||
return 'Generating Content Ideas & Outline';
|
return 'Generating Content Ideas & Outline';
|
||||||
|
} else if (funcName.includes('image')) {
|
||||||
|
// For image prompts, use fixed heading
|
||||||
|
return 'Smart Image Prompts';
|
||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
})()}
|
})()}
|
||||||
</h3>
|
</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' && (
|
{!showSuccess && status !== 'completed' && (
|
||||||
<p className="text-sm text-gray-600 dark:text-gray-400 text-center">{message}</p>
|
<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
|
// Open progress modal for async task
|
||||||
progressModal.openModal(
|
progressModal.openModal(
|
||||||
result.task_id,
|
result.task_id,
|
||||||
'Generate Image Prompts',
|
'Smart Image Prompts',
|
||||||
'ai-generate-image-prompts-01-desktop'
|
'ai-generate-image-prompts-01-desktop'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user