Skip to content

Commit 0064c30

Browse files
tahierhussainclaude
andcommitted
fix: add troubleshoot button to error messages
Add a "Troubleshoot this" button inside error alerts that sends the error message to AI for troubleshooting assistance. The button only appears for actual errors (not warnings or credit errors). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b1dd61d commit 0064c30

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

frontend/src/ide/chat-ai/Conversation.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ const Conversation = memo(function Conversation({
3232
setDetectedAction(actionType);
3333
}, []);
3434

35+
// Handle troubleshoot button click from error messages
36+
const handleTroubleshoot = useCallback(
37+
(errorMessage) => {
38+
const prompt = `There was an error encountered. We have the detailed error message below. Please see how we can fix this:\n\n${errorMessage}`;
39+
savePrompt(prompt, selectedChatIntent);
40+
},
41+
[savePrompt, selectedChatIntent]
42+
);
43+
3544
// Create UI action object based on detected action
3645
const uiAction = useMemo(() => {
3746
if (!detectedAction) return null;
@@ -168,7 +177,7 @@ const Conversation = memo(function Conversation({
168177
socketError={message?.error_msg}
169178
promptError={message?.prompt_error_message}
170179
transformError={message?.transformation_error_message}
171-
errorState={message?.error_state}
180+
onTroubleshoot={handleTroubleshoot}
172181
/>
173182
</Space>
174183
{isLastConversation ? <div className="pad-12" /> : <Divider />}

frontend/src/ide/chat-ai/DisplayErrorMessages.jsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { memo, useMemo } from "react";
22
import PropTypes from "prop-types";
3-
import { Alert, Space } from "antd";
3+
import { Alert, Button, Space } from "antd";
4+
import { ToolOutlined } from "@ant-design/icons";
45
import ReactMarkdown from "react-markdown";
56
import remarkGfm from "remark-gfm";
67

@@ -16,6 +17,7 @@ const DisplayErrorMessages = memo(function DisplayErrorMessages({
1617
socketError,
1718
promptError,
1819
transformError,
20+
onTroubleshoot,
1921
}) {
2022
const errors = useMemo(() => {
2123
const list = [];
@@ -53,6 +55,19 @@ const DisplayErrorMessages = memo(function DisplayErrorMessages({
5355
}
5456
type={showAsWarning ? "warning" : "error"}
5557
className="width-100"
58+
description={
59+
!showAsWarning && onTroubleshoot ? (
60+
<Button
61+
type="link"
62+
size="small"
63+
icon={<ToolOutlined />}
64+
onClick={() => onTroubleshoot(text)}
65+
style={{ padding: 0, marginTop: 8 }}
66+
>
67+
Troubleshoot this
68+
</Button>
69+
) : null
70+
}
5671
/>
5772
</div>
5873
);
@@ -77,12 +92,14 @@ DisplayErrorMessages.propTypes = {
7792
transformError: PropTypes.shape({
7893
error_message: PropTypes.string,
7994
}),
95+
onTroubleshoot: PropTypes.func,
8096
};
8197

8298
DisplayErrorMessages.defaultProps = {
8399
socketError: null,
84100
promptError: null,
85101
transformError: null,
102+
onTroubleshoot: null,
86103
};
87104

88105
export { DisplayErrorMessages };

0 commit comments

Comments
 (0)