Update ProgressModal.tsx

This commit is contained in:
Desktop
2025-11-11 01:54:41 +05:00
parent 1b6d431971
commit 2f5ec140f6

View File

@@ -55,15 +55,12 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
return 'Clustering complete\nKeywords mapped and grouped into clusters'; return 'Clustering complete\nKeywords mapped and grouped into clusters';
} }
if (funcName.includes('idea')) { if (funcName.includes('idea')) {
const clusterCount = extractCount(/(\d+)\s+cluster/i, stepLogs || []);
const ideaCount = extractCount(/(\d+)\s+idea/i, stepLogs || []); const ideaCount = extractCount(/(\d+)\s+idea/i, stepLogs || []);
if (ideaCount) { if (ideaCount) {
return `Content ideas created successfully${ideaCount} idea${ideaCount !== '1' ? 's' : ''} generated.`; return `Content ideas & outlines created successfully`;
} else if (clusterCount) {
return `Content ideas created successfully — generated for ${clusterCount} cluster${clusterCount !== '1' ? 's' : ''}.`;
} }
return 'Content ideas and outlines created successfully.'; return 'Content ideas & outlines created successfully';
} }
if (funcName.includes('content')) { if (funcName.includes('content')) {
const taskCount = extractCount(/(\d+)\s+task/i, stepLogs || []); const taskCount = extractCount(/(\d+)\s+task/i, stepLogs || []);
@@ -106,11 +103,11 @@ const getStepsForFunction = (functionId?: string, title?: string): Array<{phase:
if (funcName.includes('idea')) { if (funcName.includes('idea')) {
return [ return [
{ phase: 'INIT', label: 'Validating clusters' }, { phase: 'INIT', label: 'Verifying cluster integrity' },
{ phase: 'PREP', label: 'Loading cluster data' }, { phase: 'PREP', label: 'Loading cluster keywords' },
{ phase: 'AI_CALL', label: 'Generating blog ideas' }, { phase: 'AI_CALL', label: 'AI started processing clusters' },
{ phase: 'PARSE', label: 'Structuring outlines' }, { phase: 'PARSE', label: 'High-opportunity ideas generated' },
{ phase: 'SAVE', label: 'Saving ideas' }, { phase: 'SAVE', label: 'Content Outline for Ideas generated' },
]; ];
} }
@@ -306,11 +303,32 @@ export default function ProgressModal({
return message; return message;
} }
} else if (funcName.includes('idea')) { } else if (funcName.includes('idea')) {
if (stepPhase === 'PARSE') { if (stepPhase === 'INIT') {
// For INIT: Show "Verifying cluster integrity"
return 'Verifying cluster integrity';
} else if (stepPhase === 'PREP') {
// For PREP: Show "Loading cluster keywords"
return 'Loading cluster keywords';
} else if (stepPhase === 'AI_CALL') {
// For AI_CALL: Show "AI started processing clusters"
return 'AI started processing clusters';
} else if (stepPhase === 'PARSE') {
// For PARSE: Show "X high-opportunity ideas generated"
const ideaCount = extractCount(/(\d+)\s+idea/i); const ideaCount = extractCount(/(\d+)\s+idea/i);
if (ideaCount) { if (ideaCount) {
return `${ideaCount} idea${ideaCount !== '1' ? 's' : ''} created`; return `${ideaCount} high-opportunity idea${ideaCount !== '1' ? 's' : ''} generated`;
} }
// Try to find idea count in any step log
for (const log of allStepLogs) {
const count = log.message?.match(/(\d+)\s+idea/i);
if (count && count[1]) {
return `${count[1]} high-opportunity idea${count[1] !== '1' ? 's' : ''} generated`;
}
}
return message;
} else if (stepPhase === 'SAVE') {
// For SAVE: Show "Content Outline for Ideas generated"
return 'Content Outline for Ideas generated';
} }
} else if (funcName.includes('content')) { } else if (funcName.includes('content')) {
if (stepPhase === 'PARSE') { if (stepPhase === 'PARSE') {
@@ -490,6 +508,9 @@ export default function ProgressModal({
return `Mapping ${keywordCountMatch[1]} Keywords into Keyword Clusters`; return `Mapping ${keywordCountMatch[1]} Keywords into Keyword Clusters`;
} }
} }
} else if (funcName.includes('idea')) {
// For idea generation, use fixed heading
return 'Generating Content Ideas & Outline';
} }
return title; return title;
})()} })()}