Spaces:
Running
Running
Update components/CodeViewer.tsx
Browse files- components/CodeViewer.tsx +14 -2
components/CodeViewer.tsx
CHANGED
|
@@ -153,6 +153,16 @@ const CodeViewer: React.FC<CodeViewerProps> = ({ nodes, edges, promptText, isOpe
|
|
| 153 |
summary: result.initialPatches.summary,
|
| 154 |
files_changed: result.initialPatches.files_changed
|
| 155 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
}
|
| 157 |
setMessages(initialMsgs);
|
| 158 |
}
|
|
@@ -169,7 +179,7 @@ const CodeViewer: React.FC<CodeViewerProps> = ({ nodes, edges, promptText, isOpe
|
|
| 169 |
};
|
| 170 |
|
| 171 |
const getStepStatus = (step: AgentStatus, current: AgentStatus) => {
|
| 172 |
-
const order = ['idle', 'architect', 'critic', 'refiner', 'evaluator', 'complete'];
|
| 173 |
const stepIdx = order.indexOf(step);
|
| 174 |
const currentIdx = order.indexOf(current);
|
| 175 |
|
|
@@ -182,7 +192,8 @@ const CodeViewer: React.FC<CodeViewerProps> = ({ nodes, edges, promptText, isOpe
|
|
| 182 |
const renderAgentStep = (step: AgentStatus, icon: React.ReactNode, label: string) => {
|
| 183 |
const statusColor = getStepStatus(step, agentStatus);
|
| 184 |
const isCurrent = agentStatus === step;
|
| 185 |
-
const
|
|
|
|
| 186 |
|
| 187 |
return (
|
| 188 |
<div className={`flex items-center gap-3 p-4 rounded-lg border border-slate-800 ${isCurrent ? 'bg-slate-800/50 border-blue-500/30' : 'bg-slate-900'}`}>
|
|
@@ -289,6 +300,7 @@ const CodeViewer: React.FC<CodeViewerProps> = ({ nodes, edges, promptText, isOpe
|
|
| 289 |
{renderAgentStep('critic', <Search size={24} />, "Reviewer Agent: Analyzing Logic")}
|
| 290 |
{renderAgentStep('refiner', <Wand2 size={24} />, "Polisher Agent: Finalizing Code")}
|
| 291 |
{renderAgentStep('evaluator', <CheckCircle2 size={24} />, "Evaluator Agent: Verifying Requirements")}
|
|
|
|
| 292 |
</div>
|
| 293 |
{agentStatus === 'complete' && (
|
| 294 |
<div className="mt-8 text-emerald-400 font-bold animate-bounce">
|
|
|
|
| 153 |
summary: result.initialPatches.summary,
|
| 154 |
files_changed: result.initialPatches.files_changed
|
| 155 |
});
|
| 156 |
+
} else if (result.autoFixError) {
|
| 157 |
+
initialMsgs.push({
|
| 158 |
+
role: 'assistant',
|
| 159 |
+
content: `I attempted to auto-fix the issues, but the auto-fixer failed: ${result.autoFixError}`
|
| 160 |
+
});
|
| 161 |
+
} else if (result.evaluation.score < 90 && result.evaluation.improvement_tasks.length > 0) {
|
| 162 |
+
initialMsgs.push({
|
| 163 |
+
role: 'assistant',
|
| 164 |
+
content: `I skipped auto-fixing because patching was not successful or no patches were applied.`
|
| 165 |
+
});
|
| 166 |
}
|
| 167 |
setMessages(initialMsgs);
|
| 168 |
}
|
|
|
|
| 179 |
};
|
| 180 |
|
| 181 |
const getStepStatus = (step: AgentStatus, current: AgentStatus) => {
|
| 182 |
+
const order = ['idle', 'architect', 'critic', 'refiner', 'evaluator', 'patcher', 'complete'];
|
| 183 |
const stepIdx = order.indexOf(step);
|
| 184 |
const currentIdx = order.indexOf(current);
|
| 185 |
|
|
|
|
| 192 |
const renderAgentStep = (step: AgentStatus, icon: React.ReactNode, label: string) => {
|
| 193 |
const statusColor = getStepStatus(step, agentStatus);
|
| 194 |
const isCurrent = agentStatus === step;
|
| 195 |
+
const order = ['architect', 'critic', 'refiner', 'evaluator', 'patcher', 'complete'];
|
| 196 |
+
const isDone = order.indexOf(agentStatus) > order.indexOf(step);
|
| 197 |
|
| 198 |
return (
|
| 199 |
<div className={`flex items-center gap-3 p-4 rounded-lg border border-slate-800 ${isCurrent ? 'bg-slate-800/50 border-blue-500/30' : 'bg-slate-900'}`}>
|
|
|
|
| 300 |
{renderAgentStep('critic', <Search size={24} />, "Reviewer Agent: Analyzing Logic")}
|
| 301 |
{renderAgentStep('refiner', <Wand2 size={24} />, "Polisher Agent: Finalizing Code")}
|
| 302 |
{renderAgentStep('evaluator', <CheckCircle2 size={24} />, "Evaluator Agent: Verifying Requirements")}
|
| 303 |
+
{renderAgentStep('patcher', <Terminal size={24} />, "Patcher Agent: Auto-fixing bugs")}
|
| 304 |
</div>
|
| 305 |
{agentStatus === 'complete' && (
|
| 306 |
<div className="mt-8 text-emerald-400 font-bold animate-bounce">
|