From afa02637a5f808ab1437cfac5f3042c0a0655379 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Sun, 31 Aug 2025 02:52:41 +0000 Subject: [PATCH] fix: Add 'Remove from context' button for file read operations to handle token limit issues - Added delete button to file read messages in ChatRow component - Button appears only for completed file reads (not during streaming) - Leverages existing deleteMessage infrastructure for proper cleanup - Removes messages from both UI (clineMessages) and API conversation history - Added 'removeFromContext' translation key for button tooltip - Helps users recover from token limit errors by removing large files Fixes #7559 --- webview-ui/src/components/chat/ChatRow.tsx | 14 ++++++++++++++ webview-ui/src/i18n/locales/en/chat.json | 1 + 2 files changed, 15 insertions(+) diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 749c19fe59..48a10e7e42 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -524,6 +524,20 @@ export const ChatRowContent = ({ : t("chat:fileOperations.wantsToRead") : t("chat:fileOperations.didRead")} + {/* Add delete button for completed file reads when not streaming */} + {message.type === "say" && !isStreaming && ( + + )}