summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-06-16 23:42:10 -0700
committerNate Sesti <sestinj@gmail.com>2023-06-16 23:42:10 -0700
commit1ea00ebe40807589ffe3d688b5f2e07295864744 (patch)
treec90a54cd359807700c8ebe71764df5e44ff08ae0
parenta1c32513082b7d94414a21827f200224dc3ff846 (diff)
downloadsncontinue-1ea00ebe40807589ffe3d688b5f2e07295864744.tar.gz
sncontinue-1ea00ebe40807589ffe3d688b5f2e07295864744.tar.bz2
sncontinue-1ea00ebe40807589ffe3d688b5f2e07295864744.zip
polishing
-rw-r--r--continuedev/src/continuedev/core/config.py15
-rw-r--r--continuedev/src/continuedev/core/sdk.py3
-rw-r--r--continuedev/src/continuedev/libs/llm/proxy_server.py2
-rw-r--r--continuedev/src/continuedev/libs/util/step_name_to_steps.py2
-rw-r--r--continuedev/src/continuedev/steps/clear_history.py10
-rw-r--r--continuedev/src/continuedev/steps/core/core.py2
-rw-r--r--extension/package-lock.json4
-rw-r--r--extension/package.json8
-rw-r--r--extension/react-app/src/components/ComboBox.tsx21
-rw-r--r--extension/react-app/src/components/HeaderButtonWithText.tsx4
-rw-r--r--extension/react-app/src/components/StepContainer.tsx1
-rw-r--r--extension/react-app/src/components/TextDialog.tsx28
-rw-r--r--extension/react-app/src/tabs/gui.tsx3
-rw-r--r--extension/src/commands.ts5
-rw-r--r--extension/src/continueIdeClient.ts2
15 files changed, 90 insertions, 20 deletions
diff --git a/continuedev/src/continuedev/core/config.py b/continuedev/src/continuedev/core/config.py
index 8f703758..1ee3a7f8 100644
--- a/continuedev/src/continuedev/core/config.py
+++ b/continuedev/src/continuedev/core/config.py
@@ -52,6 +52,11 @@ class ContinueConfig(BaseModel):
name="feedback",
description="Send feedback to improve Continue",
step_name="FeedbackStep",
+ ),
+ SlashCommand(
+ name="clear",
+ description="Clear step history",
+ step_name="ClearHistoryStep",
)
]
on_traceback: Optional[List[OnTracebackSteps]] = [
@@ -68,10 +73,16 @@ def load_config(config_file: str) -> ContinueConfig:
_, ext = os.path.splitext(config_file)
if ext == '.yaml':
with open(config_file, 'r') as f:
- config_dict = yaml.safe_load(f)
+ try:
+ config_dict = yaml.safe_load(f)
+ except:
+ return ContinueConfig()
elif ext == '.json':
with open(config_file, 'r') as f:
- config_dict = json.load(f)
+ try:
+ config_dict = json.load(f)
+ except:
+ return ContinueConfig()
else:
raise ValueError(f'Unknown config file extension: {ext}')
return ContinueConfig(**config_dict)
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index 7639d010..4ab2f027 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -192,3 +192,6 @@ class ContinueSDK(AbstractContinueSDK):
async def update_ui(self):
await self.__autopilot.update_subscribers()
+
+ async def clear_history(self):
+ await self.__autopilot.clear_history()
diff --git a/continuedev/src/continuedev/libs/llm/proxy_server.py b/continuedev/src/continuedev/libs/llm/proxy_server.py
index 93f2d48a..dd0d3aca 100644
--- a/continuedev/src/continuedev/libs/llm/proxy_server.py
+++ b/continuedev/src/continuedev/libs/llm/proxy_server.py
@@ -18,7 +18,7 @@ CHAT_MODELS = {
}
# SERVER_URL = "http://127.0.0.1:8080"
-SERVER_URL = "https://proxy-server-l6vsfbzhba-uc.a.run.app"
+SERVER_URL = "https://proxy-server-l6vsfbzhba-uw.a.run.app"
class ProxyServer(LLM):
diff --git a/continuedev/src/continuedev/libs/util/step_name_to_steps.py b/continuedev/src/continuedev/libs/util/step_name_to_steps.py
index 2c4474af..f431f317 100644
--- a/continuedev/src/continuedev/libs/util/step_name_to_steps.py
+++ b/continuedev/src/continuedev/libs/util/step_name_to_steps.py
@@ -11,6 +11,7 @@ from ...recipes.CreatePipelineRecipe.main import CreatePipelineRecipe
from ...recipes.DDtoBQRecipe.main import DDtoBQRecipe
from ...recipes.DeployPipelineAirflowRecipe.main import DeployPipelineAirflowRecipe
from ...steps.on_traceback import DefaultOnTracebackStep
+from ...steps.clear_history import ClearHistoryStep
# This mapping is used to convert from string in ContinueConfig json to corresponding Step class.
# Used for example in slash_commands and steps_on_startup
@@ -25,6 +26,7 @@ step_name_to_step_class = {
"DDtoBQRecipe": DDtoBQRecipe,
"DeployPipelineAirflowRecipe": DeployPipelineAirflowRecipe,
"DefaultOnTracebackStep": DefaultOnTracebackStep,
+ "ClearHistoryStep": ClearHistoryStep,
}
diff --git a/continuedev/src/continuedev/steps/clear_history.py b/continuedev/src/continuedev/steps/clear_history.py
new file mode 100644
index 00000000..a875c6d3
--- /dev/null
+++ b/continuedev/src/continuedev/steps/clear_history.py
@@ -0,0 +1,10 @@
+from ..core.main import Step
+from ..core.sdk import ContinueSDK
+
+
+class ClearHistoryStep(Step):
+ name: str = "Clear History"
+ hide: bool = True
+
+ async def run(self, sdk: ContinueSDK):
+ await sdk.clear_history()
diff --git a/continuedev/src/continuedev/steps/core/core.py b/continuedev/src/continuedev/steps/core/core.py
index 59af5f38..330f60ed 100644
--- a/continuedev/src/continuedev/steps/core/core.py
+++ b/continuedev/src/continuedev/steps/core/core.py
@@ -186,6 +186,8 @@ class DefaultModelEditCodeStep(Step):
completion = completion.removesuffix(eot_token)
# Remove tags and If it accidentally includes prefix or suffix, remove it
+ if completion.strip().startswith("```"):
+ completion = completion.strip().removeprefix("```").removesuffix("```")
completion = completion.replace("<file_prefix>", "").replace("<file_suffix>", "").replace(
"<commit_before>", "").replace("<commit_msg>", "").replace("<commit_after>", "")
completion = completion.removeprefix(segs[0])
diff --git a/extension/package-lock.json b/extension/package-lock.json
index 86c816e0..92df6a4f 100644
--- a/extension/package-lock.json
+++ b/extension/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "continue",
- "version": "0.0.47",
+ "version": "0.0.50",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.0.47",
+ "version": "0.0.50",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
diff --git a/extension/package.json b/extension/package.json
index 3a3927f3..a875c82d 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "Refine code 10x faster",
- "version": "0.0.47",
+ "version": "0.0.50",
"publisher": "Continue",
"engines": {
"vscode": "^1.74.0"
@@ -86,8 +86,8 @@
"activitybar": [
{
"id": "continue",
- "title": "Continue",
- "icon": "media/continue-gradient.png"
+ "title": "Continue ",
+ "icon": "react-app/dist/continue_arrow.png"
}
]
},
@@ -96,7 +96,7 @@
{
"type": "webview",
"id": "continue.continueGUIView",
- "name": ")",
+ "name": " )",
"visibility": "visible"
}
]
diff --git a/extension/react-app/src/components/ComboBox.tsx b/extension/react-app/src/components/ComboBox.tsx
index 2b140567..29f8a53b 100644
--- a/extension/react-app/src/components/ComboBox.tsx
+++ b/extension/react-app/src/components/ComboBox.tsx
@@ -68,6 +68,9 @@ interface ComboBoxProps {
}
const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
+ const [history, setHistory] = React.useState<string[]>([]);
+ // The position of the current command you are typing now, so the one that will be appended to history once you press enter
+ const [positionInHistory, setPositionInHistory] = React.useState<number>(0);
const [items, setItems] = React.useState(props.items);
const {
isOpen,
@@ -113,9 +116,27 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
(event.nativeEvent as any).preventDownshiftDefault = true;
if (props.onEnter) props.onEnter(event);
setInputValue("");
+ const value = event.currentTarget.value;
+ if (value !== "") {
+ setPositionInHistory(history.length + 1);
+ setHistory([...history, value]);
+ }
} else if (event.key === "Tab" && items.length > 0) {
setInputValue(items[0].name);
event.preventDefault();
+ } else if (event.key === "ArrowUp" && !isOpen) {
+ if (positionInHistory == 0) return;
+ setInputValue(history[positionInHistory - 1]);
+ setPositionInHistory((prev) => prev - 1);
+ } else if (event.key === "ArrowDown" && !isOpen) {
+ if (positionInHistory >= history.length - 1) {
+ setInputValue("");
+ } else {
+ setInputValue(history[positionInHistory + 1]);
+ }
+ setPositionInHistory((prev) =>
+ Math.min(prev + 1, history.length)
+ );
}
},
ref: ref as any,
diff --git a/extension/react-app/src/components/HeaderButtonWithText.tsx b/extension/react-app/src/components/HeaderButtonWithText.tsx
index c4f22211..f9483f0f 100644
--- a/extension/react-app/src/components/HeaderButtonWithText.tsx
+++ b/extension/react-app/src/components/HeaderButtonWithText.tsx
@@ -15,9 +15,7 @@ const HeaderButtonWithText = (props: HeaderButtonWithTextProps) => {
style={{ padding: "3px" }}
onMouseEnter={() => setHover(true)}
onMouseLeave={() => {
- setTimeout(() => {
- setHover(false);
- }, 100);
+ setHover(false);
}}
onClick={props.onClick}
>
diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx
index 480f517f..7adbd7c2 100644
--- a/extension/react-app/src/components/StepContainer.tsx
+++ b/extension/react-app/src/components/StepContainer.tsx
@@ -63,7 +63,6 @@ const HeaderDiv = styled.div<{ error: boolean }>`
const ContentDiv = styled.div`
padding: 8px;
padding-left: 16px;
- background-color: ${vscBackground};
`;
const OnHoverDiv = styled.div`
diff --git a/extension/react-app/src/components/TextDialog.tsx b/extension/react-app/src/components/TextDialog.tsx
index 167e12cf..31a385d5 100644
--- a/extension/react-app/src/components/TextDialog.tsx
+++ b/extension/react-app/src/components/TextDialog.tsx
@@ -1,5 +1,5 @@
// Write a component that displays a dialog box with a text field and a button.
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import styled from "styled-components";
import { Button, buttonColor, secondaryDark, vscBackground } from ".";
@@ -28,6 +28,10 @@ const TextArea = styled.textarea`
padding: 8px;
outline: 1px solid black;
font-family: Arial, Helvetica, sans-serif;
+
+ &:focus {
+ outline: 1px solid orange;
+ }
`;
const P = styled.p`
@@ -38,19 +42,39 @@ const P = styled.p`
const TextDialog = (props: {
showDialog: boolean;
onEnter: (text: string) => void;
+ onClose: () => void;
}) => {
const [text, setText] = useState("");
const textAreaRef = React.createRef<HTMLTextAreaElement>();
+ useEffect(() => {
+ if (textAreaRef.current) {
+ textAreaRef.current.focus();
+ }
+ }, [props.showDialog]);
+
return (
<DialogContainer hidden={!props.showDialog}>
<Dialog>
<P>Thanks for your feedback. We'll get back to you soon!</P>
- <TextArea cols={50} rows={10} ref={textAreaRef}></TextArea>
+ <TextArea
+ cols={50}
+ rows={10}
+ ref={textAreaRef}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && e.metaKey && textAreaRef.current) {
+ props.onEnter(textAreaRef.current.value);
+ setText("");
+ } else if (e.key === "Escape") {
+ props.onClose();
+ }
+ }}
+ />
<Button
onClick={() => {
if (textAreaRef.current) {
props.onEnter(textAreaRef.current.value);
+ setText("");
}
}}
>
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 994cb896..63da595f 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -297,6 +297,9 @@ function GUI(props: GUIProps) {
client?.sendMainInput(`/feedback ${text}`);
setShowFeedbackDialog(false);
}}
+ onClose={() => {
+ setShowFeedbackDialog(false);
+ }}
></TextDialog>
<TopGUIDiv
diff --git a/extension/src/commands.ts b/extension/src/commands.ts
index c98cd3c3..5392a7a3 100644
--- a/extension/src/commands.ts
+++ b/extension/src/commands.ts
@@ -61,12 +61,9 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
"continue.suggestionUp": suggestionUpCommand,
"continue.acceptSuggestion": acceptSuggestionCommand,
"continue.rejectSuggestion": rejectSuggestionCommand,
- "continue.openContinueGUI": () => {
- ideProtocolClient.openGUI();
- },
"continue.focusContinueInput": async () => {
if (!debugPanelWebview) {
- await ideProtocolClient.openGUI();
+ vscode.commands.executeCommand("continue.continueGUIView.focus");
}
debugPanelWebview?.postMessage({
type: "focusContinueInput",
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 9a93a4ef..b4937ac4 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -192,7 +192,7 @@ class IdeProtocolClient {
async getUserSecret(key: string) {
// Check if secret already exists in VS Code settings (global)
let secret = vscode.workspace.getConfiguration("continue").get(key);
- if (typeof secret !== "undefined") return secret;
+ if (typeof secret !== "undefined" && secret !== null) return secret;
// If not, ask user for secret
secret = await vscode.window.showInputBox({