ai debug and modal texts

This commit is contained in:
Desktop
2025-11-11 01:37:04 +05:00
parent 92c89a095e
commit 1b6d431971
4 changed files with 142 additions and 46 deletions

View File

@@ -46,13 +46,13 @@ const getSuccessMessage = (functionId?: string, title?: string, stepLogs?: any[]
const clusterCount = extractCount(/(\d+)\s+cluster/i, stepLogs || []);
if (keywordCount && clusterCount) {
return `Clustering complete\n${clusterCount} cluster${clusterCount !== '1' ? 's' : ''} created from ${keywordCount} keyword${keywordCount !== '1' ? 's' : ''}`;
return `Clustering complete\n${keywordCount} keyword${keywordCount !== '1' ? 's' : ''} mapped and grouped into ${clusterCount} cluster${clusterCount !== '1' ? 's' : ''}`;
} else if (clusterCount) {
return `Clustering complete\n${clusterCount} cluster${clusterCount !== '1' ? 's' : ''} created`;
} else if (keywordCount) {
return `Clustering complete\nProcessed ${keywordCount} keyword${keywordCount !== '1' ? 's' : ''}`;
return `Clustering complete\n${keywordCount} keyword${keywordCount !== '1' ? 's' : ''} mapped and grouped into clusters`;
}
return 'Clustering complete\nKeywords grouped into meaningful clusters';
return 'Clustering complete\nKeywords mapped and grouped into clusters';
}
if (funcName.includes('idea')) {
const clusterCount = extractCount(/(\d+)\s+cluster/i, stepLogs || []);
@@ -462,7 +462,37 @@ export default function ProgressModal({
{/* Header */}
<div className="mb-6">
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-1 text-center">
{title}
{(() => {
const funcName = (functionId || title || '').toLowerCase();
if (funcName.includes('cluster')) {
// Try to extract keyword count from INIT step
const initStepLog = stepLogs.find(log => log.stepName === 'INIT');
if (initStepLog?.message) {
const message = initStepLog.message;
// Try to extract from "Validating keyword1, keyword2, keyword3 and 5 more keywords"
const countMatch = message.match(/(\d+)\s+more keyword/i);
if (countMatch) {
const moreCount = parseInt(countMatch[1], 10);
const shownCount = 3; // Typically shows 3 keywords
const totalCount = shownCount + moreCount;
return `Mapping ${totalCount} Keywords into Keyword Clusters`;
}
// Try to extract from "Validating X keywords"
const simpleMatch = message.match(/(\d+)\s+keyword/i);
if (simpleMatch) {
return `Mapping ${simpleMatch[1]} Keywords into Keyword Clusters`;
}
}
// Try to find keyword count in any step log
for (const log of stepLogs) {
const keywordCountMatch = log.message?.match(/(\d+)\s+keyword/i);
if (keywordCountMatch) {
return `Mapping ${keywordCountMatch[1]} Keywords into Keyword Clusters`;
}
}
}
return title;
})()}
</h3>
{!showSuccess && status !== 'completed' && (
<p className="text-sm text-gray-600 dark:text-gray-400 text-center">{message}</p>