Add function_id tracking and enable JSON mode for all AI functions
This commit is contained in:
@@ -19,8 +19,16 @@ export interface ProgressModalProps {
|
||||
onClose?: () => void;
|
||||
onCancel?: () => void;
|
||||
taskId?: string;
|
||||
functionId?: string; // AI function ID for tracking (e.g., "ai-cluster-01")
|
||||
}
|
||||
|
||||
// Generate modal instance ID (increments per modal instance)
|
||||
let modalInstanceCounter = 0;
|
||||
const getModalInstanceId = () => {
|
||||
modalInstanceCounter++;
|
||||
return `modal-${String(modalInstanceCounter).padStart(2, '0')}`;
|
||||
};
|
||||
|
||||
export default function ProgressModal({
|
||||
isOpen,
|
||||
title,
|
||||
@@ -31,7 +39,17 @@ export default function ProgressModal({
|
||||
onClose,
|
||||
onCancel,
|
||||
taskId,
|
||||
functionId,
|
||||
}: ProgressModalProps) {
|
||||
// Generate modal instance ID on first render
|
||||
const modalInstanceIdRef = React.useRef<string | null>(null);
|
||||
if (!modalInstanceIdRef.current) {
|
||||
modalInstanceIdRef.current = getModalInstanceId();
|
||||
}
|
||||
const modalInstanceId = modalInstanceIdRef.current;
|
||||
|
||||
// Build full function ID with modal instance
|
||||
const fullFunctionId = functionId ? `${functionId}-${modalInstanceId}` : null;
|
||||
// Auto-close on completion after 2 seconds
|
||||
// Don't auto-close on error - let user manually close to see error details
|
||||
const hasAutoClosedRef = React.useRef(false);
|
||||
@@ -175,10 +193,15 @@ export default function ProgressModal({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Task ID (for debugging) */}
|
||||
{taskId && import.meta.env.DEV && (
|
||||
<div className="mb-4 text-xs text-gray-400 dark:text-gray-600">
|
||||
Task ID: {taskId}
|
||||
{/* Function ID and Task ID (for debugging) */}
|
||||
{(fullFunctionId || taskId) && import.meta.env.DEV && (
|
||||
<div className="mb-4 space-y-1 text-xs text-gray-400 dark:text-gray-600">
|
||||
{fullFunctionId && (
|
||||
<div>Function ID: {fullFunctionId}</div>
|
||||
)}
|
||||
{taskId && (
|
||||
<div>Task ID: {taskId}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user