multi sector clustering erroro rasing, adn tasks page word coutn monthly limits removal

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-19 08:20:43 +00:00
parent e57c4bf1ac
commit 29ce8139d9
8 changed files with 155 additions and 86 deletions

View File

@@ -667,7 +667,7 @@ export default function ProgressModal({
className="max-w-lg"
showCloseButton={false}
>
<div className="p-6 min-h-[200px]">
<div className={`p-6 ${status === 'error' ? 'min-h-[140px]' : 'min-h-[200px]'}`}>
{/* Header */}
<div className="mb-6">
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-1 text-center">
@@ -735,7 +735,7 @@ export default function ProgressModal({
}
return null;
})()}
{!showSuccess && status !== 'completed' && (
{!showSuccess && status !== 'completed' && status !== 'error' && (
<p className="text-sm text-gray-600 dark:text-gray-400 text-center">
{(() => {
const funcName = (functionId || title || '').toLowerCase();
@@ -791,7 +791,29 @@ export default function ProgressModal({
</div>
)}
{/* Checklist-style Progress Steps - Always visible */}
{/* Error Alert (shown when status is error) */}
{status === 'error' && (
<div className="mb-6">
{/* Big centered error icon */}
<div className="flex justify-center mb-4">
<div className="w-16 h-16 rounded-full bg-error-600 dark:bg-error-700 flex items-center justify-center">
<svg className="w-10 h-10 text-white" fill="currentColor" viewBox="0 0 20 20">
<path fillRule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clipRule="evenodd" />
</svg>
</div>
</div>
{/* Dark error alert box with centered text */}
<div className="p-5 rounded-lg bg-error-600 dark:bg-error-700 border border-error-700 dark:border-error-600">
<div className="text-base font-semibold text-white text-center whitespace-pre-line">
{message}
</div>
</div>
</div>
)}
{/* Checklist-style Progress Steps - Hide on error */}
{status !== 'error' && (
<div className="mb-6 space-y-3">
{checklistItems.map((item, index) => (
<div
@@ -826,6 +848,7 @@ export default function ProgressModal({
</div>
))}
</div>
)}
{/* Footer */}
{showSuccess && onClose && (

View File

@@ -304,6 +304,67 @@ export function useProgressModal(): UseProgressModalReturn {
if (response.state === 'PROGRESS') {
const meta = response.meta || {};
const result = (meta as any).result || {};
const details = (meta as any).details || {};
const failedSuccess = meta.success === false || result.success === false || details.success === false;
// Check if this is an error in progress (validation failed during execution)
if (failedSuccess || meta.phase === 'ERROR' || (meta.error && meta.error_type)) {
const errorMsg = meta.error || result.error || details.error || meta.message || 'Operation failed';
const errorType = meta.error_type || result.error_type || details.error_type || 'Error';
setProgress({
percentage: 0,
message: `${errorType}: ${errorMsg}`,
status: 'error',
details: meta.details,
});
// Update step logs from error response
if (meta.request_steps || meta.response_steps) {
const allSteps: Array<{
stepNumber: number;
stepName: string;
status: string;
message: string;
timestamp?: number;
}> = [];
if (meta.request_steps && Array.isArray(meta.request_steps)) {
meta.request_steps.forEach((step: any) => {
allSteps.push({
stepNumber: step.stepNumber || 0,
stepName: step.stepName || 'Unknown',
status: step.status || 'error',
message: step.message || step.error || '',
timestamp: step.timestamp,
});
});
}
if (meta.response_steps && Array.isArray(meta.response_steps)) {
meta.response_steps.forEach((step: any) => {
allSteps.push({
stepNumber: step.stepNumber || 0,
stepName: step.stepName || 'Unknown',
status: step.status || 'error',
message: step.message || step.error || '',
timestamp: step.timestamp,
});
});
}
allSteps.sort((a, b) => a.stepNumber - b.stepNumber);
setStepLogs(allSteps);
}
// Stop polling on validation error
isStopped = true;
if (intervalId) {
clearInterval(intervalId);
intervalId = null;
}
return;
}
// Determine current step from request_steps/response_steps first (most accurate)
let currentStep: string | null = null;
@@ -519,6 +580,69 @@ export function useProgressModal(): UseProgressModalReturn {
}
} else if (response.state === 'SUCCESS') {
const meta = response.meta || {};
const result = (meta as any).result || {};
const details = (meta as any).details || {};
const failedSuccess = meta.success === false || result.success === false || details.success === false;
// Check if the task completed but with a validation/business logic error
// (success: false can be returned inside meta.result/meta.details)
if (failedSuccess) {
// This is a validation or business logic error - treat as failure
const errorMsg = meta.error || result.error || details.error || meta.message || 'Operation failed';
const errorType = meta.error_type || result.error_type || details.error_type || 'Error';
setProgress({
percentage: 0,
message: `${errorType}: ${errorMsg}`,
status: 'error',
details: meta.details,
});
// Update step logs from failure response
if (meta.request_steps || meta.response_steps) {
const allSteps: Array<{
stepNumber: number;
stepName: string;
status: string;
message: string;
timestamp?: number;
}> = [];
if (meta.request_steps && Array.isArray(meta.request_steps)) {
meta.request_steps.forEach((step: any) => {
allSteps.push({
stepNumber: step.stepNumber || 0,
stepName: step.stepName || 'Unknown',
status: step.status || 'error',
message: step.message || step.error || '',
timestamp: step.timestamp,
});
});
}
if (meta.response_steps && Array.isArray(meta.response_steps)) {
meta.response_steps.forEach((step: any) => {
allSteps.push({
stepNumber: step.stepNumber || 0,
stepName: step.stepName || 'Unknown',
status: step.status || 'error',
message: step.message || step.error || '',
timestamp: step.timestamp,
});
});
}
allSteps.sort((a, b) => a.stepNumber - b.stepNumber);
setStepLogs(allSteps);
}
// Stop polling on validation error
isStopped = true;
if (intervalId) {
clearInterval(intervalId);
intervalId = null;
}
return;
}
// Clear any existing transition timeout
if (stepTransitionTimeoutRef.current) {