Spaces:
Running
Running
Update components/FixerModal.tsx
Browse files- components/FixerModal.tsx +19 -8
components/FixerModal.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
|
|
|
|
| 2 |
import React, { useState, useEffect } from 'react';
|
| 3 |
import { Wrench, X, Bug, HardHat, CheckCircle2, Play, AlertTriangle } from 'lucide-react';
|
| 4 |
import { fixArchitectureErrors, AgentStatus } from '../services/geminiService';
|
|
@@ -8,7 +9,7 @@ import { NodeData } from '../types';
|
|
| 8 |
interface FixerModalProps {
|
| 9 |
isOpen: boolean;
|
| 10 |
onClose: () => void;
|
| 11 |
-
onApply: (nodes: any[], edges: any[]) => void;
|
| 12 |
errorMsg: string;
|
| 13 |
nodes: Node<NodeData>[];
|
| 14 |
edges: Edge[];
|
|
@@ -41,18 +42,28 @@ const FixerModal: React.FC<FixerModalProps> = ({ isOpen, onClose, onApply, error
|
|
| 41 |
});
|
| 42 |
|
| 43 |
if (result && result.nodes && result.edges) {
|
| 44 |
-
// Post-process to ensure compatibility
|
| 45 |
-
const processedNodes = result.nodes.map((n: any) =>
|
| 46 |
-
|
| 47 |
-
type
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
const processedEdges = result.edges.map((e: any) => ({
|
| 51 |
...e, animated: true, style: { stroke: '#94a3b8' }
|
| 52 |
}));
|
| 53 |
|
| 54 |
setTimeout(() => {
|
| 55 |
-
onApply(processedNodes, processedEdges);
|
| 56 |
onClose();
|
| 57 |
}, 1000);
|
| 58 |
}
|
|
|
|
| 1 |
|
| 2 |
+
|
| 3 |
import React, { useState, useEffect } from 'react';
|
| 4 |
import { Wrench, X, Bug, HardHat, CheckCircle2, Play, AlertTriangle } from 'lucide-react';
|
| 5 |
import { fixArchitectureErrors, AgentStatus } from '../services/geminiService';
|
|
|
|
| 9 |
interface FixerModalProps {
|
| 10 |
isOpen: boolean;
|
| 11 |
onClose: () => void;
|
| 12 |
+
onApply: (nodes: any[], edges: any[], logMsg?: string) => void;
|
| 13 |
errorMsg: string;
|
| 14 |
nodes: Node<NodeData>[];
|
| 15 |
edges: Edge[];
|
|
|
|
| 42 |
});
|
| 43 |
|
| 44 |
if (result && result.nodes && result.edges) {
|
| 45 |
+
// Post-process to ensure compatibility and safe access
|
| 46 |
+
const processedNodes = result.nodes.map((n: any) => {
|
| 47 |
+
const data = n.data || {};
|
| 48 |
+
const type = data.type || n.type || 'Identity'; // Fallback
|
| 49 |
+
return {
|
| 50 |
+
...n,
|
| 51 |
+
type: 'custom',
|
| 52 |
+
data: {
|
| 53 |
+
...data,
|
| 54 |
+
type: type,
|
| 55 |
+
label: data.label || n.label || type, // Safe access
|
| 56 |
+
params: data.params || {}
|
| 57 |
+
}
|
| 58 |
+
};
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
const processedEdges = result.edges.map((e: any) => ({
|
| 62 |
...e, animated: true, style: { stroke: '#94a3b8' }
|
| 63 |
}));
|
| 64 |
|
| 65 |
setTimeout(() => {
|
| 66 |
+
onApply(processedNodes, processedEdges, "Auto-Fixer agents applied corrections.");
|
| 67 |
onClose();
|
| 68 |
}, 1000);
|
| 69 |
}
|