diff --git a/.prettierrc b/.prettierrc index 46664808a..7b5484dd7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,5 +2,8 @@ "tabWidth": 2, "useTabs": false, "trailingComma": "all", + "semi": true, + "singleQuote": false, + "bracketSpacing": true, "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/gui/package-lock.json b/gui/package-lock.json index ef9f8cda9..b0be81c6c 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -37,7 +37,7 @@ "react-dom": "^18.2.0", "react-error-boundary": "^4.0.11", "react-hook-form": "^7.47.0", - "react-intersection-observer": "^9.10.3", + "react-intersection-observer": "^9.13.1", "react-markdown": "^9.0.1", "react-redux": "^8.0.5", "react-remark": "^2.1.0", diff --git a/gui/package.json b/gui/package.json index dae097902..ef77ac910 100644 --- a/gui/package.json +++ b/gui/package.json @@ -45,7 +45,7 @@ "react-dom": "^18.2.0", "react-error-boundary": "^4.0.11", "react-hook-form": "^7.47.0", - "react-intersection-observer": "^9.10.3", + "react-intersection-observer": "^9.13.1", "react-markdown": "^9.0.1", "react-redux": "^8.0.5", "react-remark": "^2.1.0", diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index 94652bc7d..c90d6c9c7 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -1,5 +1,4 @@ import { - ArrowPathIcon, BarsArrowDownIcon, HandThumbDownIcon, HandThumbUpIcon, @@ -14,7 +13,7 @@ import { vscBackground, vscInputBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import useUIConfig from "../../hooks/useUIConfig"; import { RootState } from "../../redux/store"; -import { getFontSize } from "../../util"; +import { getFontSize, getMetaKeyLabel } from "../../util"; import ButtonWithTooltip from "../ButtonWithTooltip"; import { CopyButton } from "../markdown/CopyButton"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; @@ -50,7 +49,7 @@ function StepContainer(props: StepContainerProps) { const isUserInput = props.item.message.role === "user"; const uiConfig = useUIConfig(); - const shouldRenderActions = !props.isLast || (props.isLast && !active); + const shouldRenderActions = !active || !props.isLast; useEffect(() => { if (!active) { @@ -84,7 +83,11 @@ function StepContainer(props: StepContainerProps) { }; return ( -
+
- - {shouldRenderActions && ( -
- {truncatedEarly && ( - - - - )} - - {props.index !== 1 && ( - - - - )} - - - +
+ {truncatedEarly && ( sendFeedback(true)} + text="Continue generation" + onClick={props.onContinueGeneration} > - + + )} + {props.index !== 1 && ( sendFeedback(false)} + onClick={props.onDelete} > - + -
- )} + )} + + + + sendFeedback(true)} + > + + + + sendFeedback(false)} + > + + +
); } diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 4924acee8..4a9ea0dfd 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -109,7 +109,7 @@ function ContinueInputBox(props: ContinueInputBoxProps) { }, [isGatheringContextStore]); return ( -
+
` overflow-y: auto; - height: 100%; scrollbar-width: ${(props) => (props.showScrollbar ? "thin" : "none")}; &::-webkit-scrollbar { @@ -75,6 +74,7 @@ const TopGuiDiv = styled.div<{ `; const StopButton = styled.div` + background-color: ${vscBackground}; width: fit-content; margin-right: auto; margin-left: auto; @@ -97,6 +97,7 @@ const StopButton = styled.div` `; const StepsDiv = styled.div` + margin-top: 8px; position: relative; background-color: transparent; @@ -147,16 +148,17 @@ export function Chat() { const { saveSession, getLastSessionId, loadLastSession } = useHistory(dispatch); - useEffect(() => { - if (!active || !topGuiDivRef.current) return; - - const scrollAreaElement = topGuiDivRef.current; - - scrollAreaElement.scrollTop = - scrollAreaElement.scrollHeight - scrollAreaElement.clientHeight; + const scrollToBottom = useCallback(() => { + if (!topGuiDivRef.current) return; + const elem = topGuiDivRef.current; + elem.scrollTop = elem.scrollHeight - elem.clientHeight; setIsAtBottom(true); - }, [active]); + }, [topGuiDivRef, setIsAtBottom]); + + useEffect(() => { + if (active) scrollToBottom(); + }, [active, scrollToBottom]); useEffect(() => { // Cmd + Backspace to delete current step @@ -311,6 +313,7 @@ export function Chat() { return ( <> 0 ? "h-full" : ""}`} ref={topGuiDivRef} onScroll={handleScroll} showScrollbar={state.config.ui?.showChatScrollbar || false} @@ -415,22 +418,56 @@ export function Chat() { ))} +
+ + -