diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 63974443f..28c844d1c 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -140,13 +140,13 @@ jobs: with: name: macOSBinary path: extension/exe/continue_server - + - uses: actions/upload-artifact@v2 if: matrix.os == 'ubuntu-20.04' && matrix.arch == 'x64' && matrix.platform == 'linux' with: name: LinuxBinary path: extension/exe/continue_server - + - uses: actions/upload-artifact@v2 if: matrix.os == 'windows-latest' && matrix.arch == 'x64' with: @@ -289,4 +289,4 @@ jobs: uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} \ No newline at end of file + branch: ${{ github.ref }} diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 1d0ca1a53..079a9b79a 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -22,7 +22,6 @@ import { ArrowLeftIcon, ArrowRightIcon, ArrowUpLeftIcon, - StopCircleIcon, TrashIcon, XMarkIcon, } from "@heroicons/react/24/outline"; @@ -275,6 +274,9 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { const workspacePaths = useSelector( (state: RootStore) => state.config.workspacePaths ); + const sessionHistory = useSelector( + (state: RootStore) => state.serverState.history + ); const [history, setHistory] = React.useState([]); // The position of the current command you are typing now, so the one that will be appended to history once you press enter @@ -1112,9 +1114,8 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { props.active ? `Stop (${getMetaKeyLabel()}⌫)` : "Delete" } > - {props.active ? ( - - ) : ( + {props.active ? null : ( + // )} @@ -1229,8 +1230,30 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { )} {props.isMainInput && ( props.onEnter?.(undefined)} + disabled={ + !(inputRef.current as any)?.value && + !( + (typeof sessionHistory?.current_index !== "undefined" && + sessionHistory.timeline[sessionHistory.current_index] + ?.active) || + false + ) + } + onClick={() => { + if ( + typeof sessionHistory?.current_index !== "undefined" && + sessionHistory.timeline[sessionHistory.current_index]?.active + ) { + client?.deleteAtIndex(sessionHistory.current_index); + } else { + props.onEnter?.(undefined); + } + }} + showStop={ + (typeof sessionHistory?.current_index !== "undefined" && + sessionHistory.timeline[sessionHistory.current_index]?.active) || + false + } /> )} diff --git a/extension/react-app/src/components/ContinueButton.tsx b/extension/react-app/src/components/ContinueButton.tsx index 95dde177b..294938dbe 100644 --- a/extension/react-app/src/components/ContinueButton.tsx +++ b/extension/react-app/src/components/ContinueButton.tsx @@ -1,6 +1,6 @@ import styled from "styled-components"; -import { Button } from "."; -import { PlayIcon } from "@heroicons/react/24/outline"; +import { Button, vscBackground } from "."; +import { PlayIcon, StopIcon } from "@heroicons/react/24/outline"; import { useSelector } from "react-redux"; import { RootStore } from "../redux/store"; import { useEffect, useState } from "react"; @@ -8,21 +8,28 @@ import { useEffect, useState } from "react"; const StyledButton = styled(Button)<{ color?: string | null; isDisabled: boolean; + showStop: boolean; }>` margin: auto; margin-top: 8px; margin-bottom: 16px; display: grid; + width: 130px; grid-template-columns: 22px 1fr; align-items: center; - background-color: ${(props) => props.color || "#be1b55"}; + background-color: ${(props) => + `${props.color || "#be1b55"}${props.showStop ? "33" : ""}`}; opacity: ${(props) => (props.isDisabled ? 0.5 : 1.0)}; + border: 1px solid + ${(props) => (props.showStop ? props.color || "#be1b55" : "transparent")}; + cursor: ${(props) => (props.isDisabled ? "default" : "pointer")}; &:hover:enabled { - background-color: ${(props) => props.color || "#be1b55"}; + background-color: ${(props) => + `${props.color || "#be1b55"}${props.showStop ? "33" : ""}`}; ${(props) => props.isDisabled ? "cursor: default;" @@ -36,6 +43,7 @@ function ContinueButton(props: { onClick?: () => void; hidden?: boolean; disabled: boolean; + showStop: boolean; }) { const vscMediaUrl = useSelector( (state: RootStore) => state.config.vscMediaUrl @@ -61,6 +69,7 @@ function ContinueButton(props: { return ( ); } diff --git a/server/continuedev/libs/llm/base.py b/server/continuedev/libs/llm/base.py index 4ba33101e..d808519e5 100644 --- a/server/continuedev/libs/llm/base.py +++ b/server/continuedev/libs/llm/base.py @@ -443,7 +443,7 @@ Settings: "model": self.model, "model_class": self.__class__.__name__, "time": ttft, - "tokens": self.count_tokens(sum(m["content"] for m in messages)) + "tokens": sum(self.count_tokens(m["content"]) for m in messages) }) else: