From 458d2837163489ebaab0b21b3d6f3ab89c6a45d2 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Tue, 4 Jul 2023 21:14:35 -0700 Subject: new stop --- extension/package-lock.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'extension/package-lock.json') diff --git a/extension/package-lock.json b/extension/package-lock.json index c9b8b757..4a3e01f2 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -15,6 +15,7 @@ "@segment/analytics-node": "^0.0.1-beta.16", "@sentry/node": "^7.57.0", "@styled-icons/heroicons-outline": "^10.47.0", + "@styled-icons/heroicons-solid": "^10.47.0", "@vitejs/plugin-react-swc": "^3.3.2", "axios": "^1.2.5", "downshift": "^7.6.0", @@ -2238,6 +2239,23 @@ "styled-components": "*" } }, + "node_modules/@styled-icons/heroicons-solid": { + "version": "10.47.0", + "resolved": "https://registry.npmjs.org/@styled-icons/heroicons-solid/-/heroicons-solid-10.47.0.tgz", + "integrity": "sha512-j+tJx2NzLG2tc91IXJVwKNjsI/osxmak+wmLfnfBsB+49srpxMYjuLPMtl9ZY/xgbNsWO36O+/N5Zf5bkgiKcQ==", + "dependencies": { + "@babel/runtime": "^7.20.7", + "@styled-icons/styled-icon": "^10.7.0" + }, + "funding": { + "type": "GitHub", + "url": "https://github.com/sponsors/jacobwgillespie" + }, + "peerDependencies": { + "react": "*", + "styled-components": "*" + } + }, "node_modules/@styled-icons/styled-icon": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/@styled-icons/styled-icon/-/styled-icon-10.7.0.tgz", @@ -13120,6 +13138,15 @@ "@styled-icons/styled-icon": "^10.7.0" } }, + "@styled-icons/heroicons-solid": { + "version": "10.47.0", + "resolved": "https://registry.npmjs.org/@styled-icons/heroicons-solid/-/heroicons-solid-10.47.0.tgz", + "integrity": "sha512-j+tJx2NzLG2tc91IXJVwKNjsI/osxmak+wmLfnfBsB+49srpxMYjuLPMtl9ZY/xgbNsWO36O+/N5Zf5bkgiKcQ==", + "requires": { + "@babel/runtime": "^7.20.7", + "@styled-icons/styled-icon": "^10.7.0" + } + }, "@styled-icons/styled-icon": { "version": "10.7.0", "resolved": "https://registry.npmjs.org/@styled-icons/styled-icon/-/styled-icon-10.7.0.tgz", -- cgit v1.2.3-70-g09d2 From f88c33041755bdf50a3a54c37cc38436a4a7c88f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 5 Jul 2023 01:17:58 -0700 Subject: test custom command, don't run shell command --- continuedev/src/continuedev/core/config.py | 5 ++++- continuedev/src/continuedev/steps/chat.py | 6 +----- extension/package-lock.json | 4 ++-- extension/package.json | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'extension/package-lock.json') diff --git a/continuedev/src/continuedev/core/config.py b/continuedev/src/continuedev/core/config.py index 9e8541dc..8f7e0b8c 100644 --- a/continuedev/src/continuedev/core/config.py +++ b/continuedev/src/continuedev/core/config.py @@ -71,7 +71,10 @@ class ContinueConfig(BaseModel): allow_anonymous_telemetry: Optional[bool] = True default_model: Literal["gpt-3.5-turbo", "gpt-3.5-turbo-16k", "gpt-4"] = 'gpt-4' - custom_commands: Optional[List[CustomCommand]] = [] + custom_commands: Optional[List[CustomCommand]] = [CustomCommand( + name="test", + prompt="Write a comprehensive set of unit tests for the selected code. It should setup, run tests that check for correctness including important edge cases, and teardown. Ensure that the tests are complete and sophisticated. Give the tests just as chat output, don't edit any file.", + )] slash_commands: Optional[List[SlashCommand]] = DEFAULT_SLASH_COMMANDS on_traceback: Optional[List[OnTracebackSteps]] = [ OnTracebackSteps(step_name="DefaultOnTracebackStep")] diff --git a/continuedev/src/continuedev/steps/chat.py b/continuedev/src/continuedev/steps/chat.py index db3f9d7f..8f88244c 100644 --- a/continuedev/src/continuedev/steps/chat.py +++ b/continuedev/src/continuedev/steps/chat.py @@ -107,12 +107,8 @@ class RunTerminalCommandStep(Step): description: str = "Run a terminal command." command: str - async def describe(self, models: Models) -> Coroutine[Any, Any, Coroutine[str, None, None]]: - return f"Ran the terminal command `{self.command}`." - async def run(self, sdk: ContinueSDK): - await sdk.wait_for_user_confirmation(f"Run the following terminal command?\n\n```bash\n{self.command}\n```") - await sdk.run(self.command) + self.description = f"Copy this command and run in your terminal:\n\n```bash\n{self.command}\n```" class ViewDirectoryTreeStep(Step): diff --git a/extension/package-lock.json b/extension/package-lock.json index 2dd7d6d4..82c28a90 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.108", + "version": "0.0.109", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.108", + "version": "0.0.109", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index d4850671..001a696e 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.108", + "version": "0.0.109", "publisher": "Continue", "engines": { "vscode": "^1.67.0" -- cgit v1.2.3-70-g09d2 From b3eb9d934ef6e73ea4f43a9fb7584e948ea9e0b5 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 5 Jul 2023 01:51:46 -0700 Subject: details --- continuedev/src/continuedev/core/policy.py | 64 ++++++++++++---------- extension/package-lock.json | 4 +- extension/package.json | 2 +- extension/react-app/src/components/ComboBox.tsx | 2 +- .../react-app/src/components/StepContainer.tsx | 12 ++-- .../src/components/UserInputContainer.tsx | 10 ++-- extension/react-app/src/tabs/gui.tsx | 18 +++--- 7 files changed, 61 insertions(+), 51 deletions(-) (limited to 'extension/package-lock.json') diff --git a/continuedev/src/continuedev/core/policy.py b/continuedev/src/continuedev/core/policy.py index b0853380..ef753ee4 100644 --- a/continuedev/src/continuedev/core/policy.py +++ b/continuedev/src/continuedev/core/policy.py @@ -1,5 +1,5 @@ from textwrap import dedent -from typing import List, Tuple, Type +from typing import List, Tuple, Type, Union from ..steps.welcome import WelcomeStep from .config import ContinueConfig @@ -22,6 +22,34 @@ from ..libs.util.step_name_to_steps import get_step_from_name from ..steps.custom_command import CustomCommandStep +def parse_slash_command(inp: str, config: ContinueConfig) -> Union[None, Step]: + """ + Parses a slash command, returning the command name and the rest of the input. + """ + if inp.startswith("/"): + command_name = inp.split(" ")[0] + after_command = " ".join(inp.split(" ")[1:]) + + for slash_command in config.slash_commands: + if slash_command.name == command_name[1:]: + params = slash_command.params + params["user_input"] = after_command + return get_step_from_name(slash_command.step_name, params) + return None + + +def parse_custom_command(inp: str, config: ContinueConfig) -> Union[None, Step]: + command_name = inp.split(" ")[0] + after_command = " ".join(inp.split(" ")[1:]) + for custom_cmd in config.custom_commands: + if custom_cmd.name == command_name[1:]: + slash_command = parse_slash_command(custom_cmd.prompt, config) + if slash_command is not None: + return slash_command + return CustomCommandStep(name=custom_cmd.name, prompt=custom_cmd.prompt, user_input=after_command) + return None + + class DemoPolicy(Policy): ran_code_last: bool = False @@ -46,34 +74,14 @@ class DemoPolicy(Policy): # This could be defined with ObservationTypePolicy. Ergonomics not right though. user_input = observation.user_input - if user_input.startswith("/"): - command_name = user_input.split(" ")[0] - after_command = " ".join(user_input.split(" ")[1:]) - for slash_command in config.slash_commands: - if slash_command.name == command_name[1:]: - params = slash_command.params - params["user_input"] = after_command - return get_step_from_name(slash_command.step_name, params) + slash_command = parse_slash_command(user_input) + if slash_command is not None: + return slash_command - for custom_cmd in config.custom_commands: - if custom_cmd.name == command_name[1:]: - return CustomCommandStep(name=custom_cmd.name, prompt=custom_cmd.prompt, user_input=after_command) + custom_command = parse_custom_command(user_input) + if custom_command is not None: + return custom_command - # return EditHighlightedCodeStep(user_input=user_input) return ChatWithFunctions(user_input=user_input) - return NLDecisionStep(user_input=user_input, steps=[ - (EditHighlightedCodeStep(user_input=user_input), - "Edit the highlighted code"), - # AnswerQuestionChroma(question=user_input), - # EditFileChroma(request=user_input), - (SimpleChatStep(user_input=user_input), - "Respond to the user with a chat message. Can answer questions about code or anything else."), - ], default_step=EditHighlightedCodeStep(user_input=user_input)) - - state = history.get_current() - if observation is not None and isinstance(observation, TracebackObservation): - self.ran_code_last = False - return SolveTracebackStep(traceback=observation.traceback) - else: - return None + return None diff --git a/extension/package-lock.json b/extension/package-lock.json index 82c28a90..ce1a42ee 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.109", + "version": "0.0.110", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.109", + "version": "0.0.110", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 001a696e..607c2ca6 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@ "displayName": "Continue", "pricing": "Free", "description": "The open-source coding autopilot", - "version": "0.0.109", + "version": "0.0.110", "publisher": "Continue", "engines": { "vscode": "^1.67.0" diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx index 97f5b57e..73b7cc2d 100644 --- a/extension/react-app/src/components/ComboBox.tsx +++ b/extension/react-app/src/components/ComboBox.tsx @@ -324,7 +324,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => { /> ))} - + Highlight code to include as context. Currently open file included by default. {highlightedCodeSections.length === 0 && ""} diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx index 183ffeef..2aed2e72 100644 --- a/extension/react-app/src/components/StepContainer.tsx +++ b/extension/react-app/src/components/StepContainer.tsx @@ -11,11 +11,9 @@ import { ChevronDown, ChevronRight, ArrowPath, - XMark + XMark, } from "@styled-icons/heroicons-outline"; -import { - Stop, -} from "@styled-icons/heroicons-solid"; +import { Stop } from "@styled-icons/heroicons-solid"; import { HistoryNode } from "../../../schema/HistoryNode"; import ReactMarkdown from "react-markdown"; import HeaderButtonWithText from "./HeaderButtonWithText"; @@ -213,7 +211,11 @@ function StepContainer(props: StepContainerProps) { text={props.historyNode.active ? "Stop" : "Delete"} active={props.historyNode.active} > - {props.historyNode.active ? :} + {props.historyNode.active ? ( + + ) : ( + + )} {props.historyNode.observation?.error ? ( ` - background-color: rgb(50 50 50); +const StyledDiv = styled.div` + background-color: rgb(45 45 45); padding: 8px; padding-left: 16px; padding-right: 16px; @@ -24,14 +24,12 @@ const StyledDiv = styled.div<{ hidden: boolean }>` font-size: 13px; display: flex; align-items: center; - visibility: ${(props) => (props.hidden ? "hidden" : "visible")}; - height: ${(props) => (props.hidden ? "0px" : "auto")}; `; const UserInputContainer = (props: UserInputContainerProps) => { return ( -