From c7e765c5d08fbd44233a7aefbfb94598d095373c Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 4 Nov 2024 17:14:48 -0800 Subject: [PATCH] remove jump on chat finish --- gui/src/components/gui/StepContainer.tsx | 5 ++-- gui/src/pages/gui/Chat.tsx | 35 +++++++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 80cb450cf..a96a6bb4d 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -93,7 +93,7 @@ function StepContainer(props: StepContainerProps) { hidden={!props.open} isUserInput={isUserInput} fontSize={getFontSize()} - + // className="pb-2" > {uiConfig?.displayRawMarkdown ? (
 
       {shouldRenderActions && (
-        
+ // Height of this should be the same as height of "Cancel" div to prevent jump +
{truncatedEarly && ( { - if (!active || !topGuiDivRef.current) return; - + if (!active || !topGuiDivRef.current) return const scrollAreaElement = topGuiDivRef.current; scrollAreaElement.scrollTop = scrollAreaElement.scrollHeight - scrollAreaElement.clientHeight; setIsAtBottom(true); - }, [active]); + }, [topGuiDivRef, active, setIsAtBottom]) useEffect(() => { // Cmd + Backspace to delete current step @@ -436,20 +435,23 @@ export function Chat() { )} {active && ( - { - dispatch(setInactive()); - if ( - state.history[state.history.length - 1]?.message.content - .length === 0 - ) { - dispatch(clearLastResponse()); - } - }} +
- {getMetaKeyLabel()} ⌫ Cancel - + { + dispatch(setInactive()); + if ( + state.history[state.history.length - 1]?.message.content + .length === 0 + ) { + dispatch(clearLastResponse()); + } + }} + > + {getMetaKeyLabel()} ⌫ Cancel + +
)}
0 ? 'pt-1 border-0 border-t border-solid border-t-zinc-700' : ''}`}>
{state.history.length > 0 ? (