Skip to content

Commit a62dd2e

Browse files
ibolton336claude
andcommitted
✨ Restore ChatMessageType.Diagnostic handling
- Add back ChatMessageType.Diagnostic message type handling in ResolutionsPage - Enable proper rendering of diagnostic messages with summary views - Fix formatting and remove unused mode parameter - Ensure proper TypeScript compilation after shared package rebuild 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Signed-off-by: Ian Bolton <[email protected]>
1 parent 1544c2b commit a62dd2e

File tree

1 file changed

+119
-86
lines changed

1 file changed

+119
-86
lines changed

webview-ui/src/components/ResolutionsPage/ResolutionsPage.tsx

Lines changed: 119 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -134,96 +134,129 @@ const ResolutionPage: React.FC = () => {
134134
setRespondedMessageTokens((prev) => new Set([...prev, messageToken]));
135135
}, []);
136136

137-
// Render chat messages - used in both modes but with different ModifiedFile handling
138-
const renderChatMessages = useCallback(
139-
(mode: "agent" | "non-agent" = "agent") => {
140-
if (!Array.isArray(chatMessages) || chatMessages?.length === 0) {
137+
// Render chat messages
138+
const renderChatMessages = useCallback(() => {
139+
if (!Array.isArray(chatMessages) || chatMessages?.length === 0) {
140+
return null;
141+
}
142+
143+
return chatMessages.map((msg) => {
144+
if (!msg) {
141145
return null;
142146
}
143147

144-
return chatMessages.map((msg) => {
145-
if (!msg) {
146-
return null;
147-
}
148-
149-
// Check if this specific message has been responded to
150-
const isMessageResponded = respondedMessageTokens.has(msg.messageToken);
151-
152-
if (msg.kind === ChatMessageType.Tool) {
153-
const { toolName, toolStatus } = msg.value as ToolMessageValue;
154-
return (
155-
<MessageWrapper key={msg.messageToken}>
156-
<ToolMessage
157-
toolName={toolName}
158-
status={toolStatus as "succeeded" | "failed" | "running"}
159-
timestamp={msg.timestamp}
160-
/>
161-
</MessageWrapper>
162-
);
163-
}
164-
165-
if (msg.kind === ChatMessageType.ModifiedFile) {
166-
const fileData = msg.value as ModifiedFileMessageValue;
167-
return (
168-
<MessageWrapper key={msg.messageToken}>
169-
<ModifiedFileMessage
170-
data={fileData}
171-
timestamp={msg.timestamp}
172-
onUserAction={triggerScrollOnUserAction}
173-
/>
174-
</MessageWrapper>
175-
);
176-
}
177-
178-
if (msg.kind === ChatMessageType.String) {
179-
const message = msg.value?.message as string;
180-
const diagnosticSummary = (msg.value as any)?.diagnosticSummary;
181-
const selectedResponse = msg.selectedResponse;
182-
183-
// Determine if we have Yes/No quick responses and create an appropriate question
184-
const hasYesNoResponses =
185-
Array.isArray(msg.quickResponses) &&
186-
msg.quickResponses.some((response) => response.id === "yes" || response.id === "no");
187-
188-
const question = hasYesNoResponses
189-
? "Would you like me to fix the selected issues?"
190-
: undefined;
191-
192-
return (
193-
<MessageWrapper key={msg.messageToken}>
194-
<ReceivedMessage
195-
timestamp={msg.timestamp}
196-
content={message}
197-
diagnosticSummary={diagnosticSummary}
198-
question={question}
199-
isMessageResponded={isMessageResponded}
200-
onQuickResponse={() => handleQuickResponse(msg.messageToken)}
201-
quickResponses={
202-
Array.isArray(msg.quickResponses) && msg.quickResponses.length > 0
203-
? msg.quickResponses.map((response) => ({
204-
...response,
205-
messageToken: msg.messageToken,
206-
isDisabled: response.id === "run-analysis" && isAnalyzing,
207-
isSelected: selectedResponse === response.id,
208-
}))
209-
: undefined
210-
}
211-
/>
212-
</MessageWrapper>
213-
);
214-
}
148+
// Check if this specific message has been responded to
149+
const isMessageResponded = respondedMessageTokens.has(msg.messageToken);
215150

216-
return null;
217-
});
218-
},
219-
[
220-
chatMessages,
221-
respondedMessageTokens,
222-
handleQuickResponse,
223-
isAnalyzing,
224-
triggerScrollOnUserAction,
225-
],
226-
);
151+
if (msg.kind === ChatMessageType.Tool) {
152+
const { toolName, toolStatus } = msg.value as ToolMessageValue;
153+
return (
154+
<MessageWrapper key={msg.messageToken}>
155+
<ToolMessage
156+
toolName={toolName}
157+
status={toolStatus as "succeeded" | "failed" | "running"}
158+
timestamp={msg.timestamp}
159+
/>
160+
</MessageWrapper>
161+
);
162+
}
163+
164+
if (msg.kind === ChatMessageType.ModifiedFile) {
165+
const fileData = msg.value as ModifiedFileMessageValue;
166+
return (
167+
<MessageWrapper key={msg.messageToken}>
168+
<ModifiedFileMessage
169+
data={fileData}
170+
timestamp={msg.timestamp}
171+
onUserAction={triggerScrollOnUserAction}
172+
/>
173+
</MessageWrapper>
174+
);
175+
}
176+
177+
if (msg.kind === ChatMessageType.Diagnostic) {
178+
const message = msg.value?.message as string;
179+
const diagnosticSummary = (msg.value as any)?.diagnosticSummary;
180+
181+
// Determine if we have Yes/No quick responses and create an appropriate question
182+
const hasYesNoResponses =
183+
Array.isArray(msg.quickResponses) &&
184+
msg.quickResponses.some((response) => response.id === "yes" || response.id === "no");
185+
186+
const question = hasYesNoResponses
187+
? "Would you like me to fix the selected issues?"
188+
: undefined;
189+
190+
return (
191+
<MessageWrapper key={msg.messageToken}>
192+
<ReceivedMessage
193+
timestamp={msg.timestamp}
194+
content={message}
195+
diagnosticSummary={diagnosticSummary}
196+
question={question}
197+
isMessageResponded={isMessageResponded}
198+
onQuickResponse={() => handleQuickResponse(msg.messageToken)}
199+
quickResponses={
200+
Array.isArray(msg.quickResponses) && msg.quickResponses.length > 0
201+
? msg.quickResponses.map((response) => ({
202+
...response,
203+
messageToken: msg.messageToken,
204+
isDisabled: response.id === "run-analysis" && isAnalyzing,
205+
}))
206+
: undefined
207+
}
208+
/>
209+
</MessageWrapper>
210+
);
211+
}
212+
213+
if (msg.kind === ChatMessageType.String) {
214+
const message = msg.value?.message as string;
215+
const diagnosticSummary = (msg.value as any)?.diagnosticSummary;
216+
const selectedResponse = msg.selectedResponse;
217+
218+
// Determine if we have Yes/No quick responses and create an appropriate question
219+
const hasYesNoResponses =
220+
Array.isArray(msg.quickResponses) &&
221+
msg.quickResponses.some((response) => response.id === "yes" || response.id === "no");
222+
223+
const question = hasYesNoResponses
224+
? "Would you like me to fix the selected issues?"
225+
: undefined;
226+
227+
return (
228+
<MessageWrapper key={msg.messageToken}>
229+
<ReceivedMessage
230+
timestamp={msg.timestamp}
231+
content={message}
232+
diagnosticSummary={diagnosticSummary}
233+
question={question}
234+
isMessageResponded={isMessageResponded}
235+
onQuickResponse={() => handleQuickResponse(msg.messageToken)}
236+
quickResponses={
237+
Array.isArray(msg.quickResponses) && msg.quickResponses.length > 0
238+
? msg.quickResponses.map((response) => ({
239+
...response,
240+
messageToken: msg.messageToken,
241+
isDisabled: response.id === "run-analysis" && isAnalyzing,
242+
isSelected: selectedResponse === response.id,
243+
}))
244+
: undefined
245+
}
246+
/>
247+
</MessageWrapper>
248+
);
249+
}
250+
251+
return null;
252+
});
253+
}, [
254+
chatMessages,
255+
respondedMessageTokens,
256+
handleQuickResponse,
257+
isAnalyzing,
258+
triggerScrollOnUserAction,
259+
]);
227260

228261
return (
229262
<Page

0 commit comments

Comments
 (0)