From 50bee7c2b0810a736bf53f5ca959292f24ae9b02 Mon Sep 17 00:00:00 2001 From: Rahul Date: Thu, 9 Oct 2025 02:01:25 -0700 Subject: [PATCH] feat: Add button to cancel LLM response (#1978) * feat: Add button to cancel LLM response - Replace text area with cancel button when loading. - Add useEffect to change elipsis in cancel button text. - Add new SVG icon for cancel response. - Button colors match Figma designs. * fix: Cancel button UI matches new design - Delete cancel-response svg. - Change previous cancel button to match the new Figma design. - Remove console log in handleCancel function. * fix: Adjust cancel button rounding * feat: Update UI for send button - Add SendArrowIcon component, enables dynamic svg color changes - Replace original icon - Update colors and hover effects * (fix:send-button) minor blink in transition --------- Co-authored-by: Manish Madan --- frontend/src/components/MessageInput.tsx | 58 +++++++++++++---------- frontend/src/components/SendArrowIcon.tsx | 17 +++++++ 2 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 frontend/src/components/SendArrowIcon.tsx diff --git a/frontend/src/components/MessageInput.tsx b/frontend/src/components/MessageInput.tsx index 1052843d..3b5bdd3c 100644 --- a/frontend/src/components/MessageInput.tsx +++ b/frontend/src/components/MessageInput.tsx @@ -7,11 +7,9 @@ import userService from '../api/services/userService'; import AlertIcon from '../assets/alert.svg'; import ClipIcon from '../assets/clip.svg'; import ExitIcon from '../assets/exit.svg'; -import PaperPlane from '../assets/paper_plane.svg'; +import SendArrowIcon from './SendArrowIcon'; import SourceIcon from '../assets/source.svg'; import DocumentationDark from '../assets/documentation-dark.svg'; -import SpinnerDark from '../assets/spinner-dark.svg'; -import Spinner from '../assets/spinner.svg'; import ToolIcon from '../assets/tool.svg'; import { addAttachment, @@ -19,7 +17,7 @@ import { selectAttachments, updateAttachment, } from '../upload/uploadSlice'; -import { useDarkTheme } from '../hooks'; + import { ActiveState } from '../models/misc'; import { selectSelectedDocs, @@ -29,6 +27,7 @@ import Upload from '../upload/Upload'; import { getOS, isTouchDevice } from '../utils/browserUtils'; import SourcesPopup from './SourcesPopup'; import ToolsPopup from './ToolsPopup'; +import { handleAbort } from '../conversation/conversationSlice'; type MessageInputProps = { onSubmit: (text: string) => void; @@ -46,7 +45,6 @@ export default function MessageInput({ autoFocus = true, }: MessageInputProps) { const { t } = useTranslation(); - const [isDarkTheme] = useDarkTheme(); const [value, setValue] = useState(''); const inputRef = useRef(null); const sourceButtonRef = useRef(null); @@ -256,6 +254,11 @@ export default function MessageInput({ setValue(''); } }; + + const handleCancel = () => { + handleAbort(); + }; + return (
@@ -427,26 +430,33 @@ export default function MessageInput({ {/* Additional badges can be added here in the future */}
- + ) : ( + + + )}
diff --git a/frontend/src/components/SendArrowIcon.tsx b/frontend/src/components/SendArrowIcon.tsx new file mode 100644 index 00000000..f88dde3d --- /dev/null +++ b/frontend/src/components/SendArrowIcon.tsx @@ -0,0 +1,17 @@ +import { SVGProps } from 'react'; +const SendArrowIcon = (props: SVGProps) => ( + + + +); +export default SendArrowIcon;