Skip to content

Commit f701d25

Browse files
committed
Fix diagnostic checking ui
1 parent 6a51b64 commit f701d25

File tree

2 files changed

+5
-3
lines changed
  • workspaces/ballerina
    • ballerina-extension/src/features/ai/service/design
    • ballerina-visualizer/src/views/AIPanel/components/AIChat

2 files changed

+5
-3
lines changed

workspaces/ballerina/ballerina-extension/src/features/ai/service/design/design.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const sdk = new NodeSDK({
5050
});
5151
sdk.start();
5252

53+
//TODO: Tool name, types and uesd in both ext and visualizer to display, either move to core or use visualizer as view only.
5354
export async function generateDesignCore(params: GenerateAgentCodeRequest, eventHandler: CopilotEventHandler): Promise<void> {
5455
const isPlanModeEnabled = params.isPlanMode;
5556
const messageId = params.messageId;

workspaces/ballerina/ballerina-visualizer/src/views/AIPanel/components/AIChat/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ const AIChat: React.FC = () => {
462462
}
463463
return newMessages;
464464
});
465-
} else if (response.toolName === "DiagnosticsTool") {
465+
} else if (response.toolName === "getCompilationErrors") {
466466
setMessages((prevMessages) => {
467467
const newMessages = [...prevMessages];
468468
if (newMessages.length > 0) {
@@ -589,9 +589,10 @@ const AIChat: React.FC = () => {
589589
}
590590
return newMessages;
591591
});
592-
} else if (response.toolName === "DiagnosticsTool") {
592+
} else if (response.toolName === "getCompilationErrors") {
593593
const diagnosticsOutput = response.toolOutput;
594-
const errors = diagnosticsOutput?.diagnostics?.filter((d: any) => d.severity === 1) || [];
594+
// Backend already filters for errors only (severity === 1), so no need to filter again
595+
const errors = diagnosticsOutput?.diagnostics || [];
595596
const errorCount = errors.length;
596597

597598
setErrorCount(errorCount);

0 commit comments

Comments
 (0)