diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-10-02 12:27:05 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-10-02 12:27:05 -0700 |
commit | a3a05fee312ad7c04d2abb0e186da55c7d061462 (patch) | |
tree | f5cd2fd04dc0b50d30c7d4074ee8472ff3c40392 | |
parent | 82bafc9ffa0eabd2b96b90bf3d375f22d62dc16a (diff) | |
download | sncontinue-a3a05fee312ad7c04d2abb0e186da55c7d061462.tar.gz sncontinue-a3a05fee312ad7c04d2abb0e186da55c7d061462.tar.bz2 sncontinue-a3a05fee312ad7c04d2abb0e186da55c7d061462.zip |
fix: :bug: change for/backwardslash decoding scheme
-rw-r--r-- | continuedev/src/continuedev/plugins/steps/main.py | 4 | ||||
-rw-r--r-- | continuedev/src/continuedev/server/gui.py | 11 | ||||
-rw-r--r-- | continuedev/src/continuedev/server/ide.py | 6 | ||||
-rw-r--r-- | extension/react-app/src/pages/history.tsx | 2 | ||||
-rw-r--r-- | extension/src/diffs.ts | 4 |
5 files changed, 20 insertions, 7 deletions
diff --git a/continuedev/src/continuedev/plugins/steps/main.py b/continuedev/src/continuedev/plugins/steps/main.py index 0698f1ae..ab4fe948 100644 --- a/continuedev/src/continuedev/plugins/steps/main.py +++ b/continuedev/src/continuedev/plugins/steps/main.py @@ -239,14 +239,14 @@ def decode_escaped_path(path: str) -> str: """We use a custom escaping scheme to record the full path of a file as a corresponding basename, but withut URL encoding, because then the URI just gets interpreted as a full path again.""" - return path.replace("$forwardslash$", "/").replace("$backslash$", "\\") + return path.replace("$f$", "/").replace("$b$", "\\") def encode_escaped_path(path: str) -> str: """We use a custom escaping scheme to record the full path of a file as a corresponding basename, but withut URL encoding, because then the URI just gets interpreted as a full path again.""" - return path.replace("/", "$forwardslash$").replace("\\", "$backslash$") + return path.replace("/", "$f$").replace("\\", "$b$") class EditAlreadyEditedRangeStep(Step): diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py index cc6bc911..26fcbd42 100644 --- a/continuedev/src/continuedev/server/gui.py +++ b/continuedev/src/continuedev/server/gui.py @@ -306,6 +306,17 @@ class GUIProtocolServer: def add_model_for_role(self, role: str, model_class: str, model: Any): models = self.session.autopilot.continue_sdk.config.models + + model_copy = model.copy() + if "api_key" in model_copy: + del model_copy["api_key"] + if "hf_token" in model_copy: + del model_copy["hf_token"] + posthog_logger.capture_event( + "select_model_for_role", + {"role": role, "model_class": model_class, "model": model_copy}, + ) + if role == "*": async def async_stuff(): diff --git a/continuedev/src/continuedev/server/ide.py b/continuedev/src/continuedev/server/ide.py index 579c8f1d..1709503b 100644 --- a/continuedev/src/continuedev/server/ide.py +++ b/continuedev/src/continuedev/server/ide.py @@ -602,7 +602,11 @@ async def websocket_endpoint(websocket: WebSocket, session_id: str = None): # Message handler def handle_msg(msg): - message = json.loads(msg) + try: + message = json.loads(msg) + except json.JSONDecodeError: + logger.critical(f"Error decoding json: {msg}") + return if "messageType" not in message or "data" not in message: return diff --git a/extension/react-app/src/pages/history.tsx b/extension/react-app/src/pages/history.tsx index 01cb71e0..63024e36 100644 --- a/extension/react-app/src/pages/history.tsx +++ b/extension/react-app/src/pages/history.tsx @@ -148,7 +148,7 @@ function History() { } return workspacePaths.includes(session.workspace_directory); }).length === 0 && ( - <div className="text-center my-4"> + <div className="text-center m-4"> No past sessions found. To start a new session, either click the "+" button or use the keyboard shortcut: <b>Option + Command + N</b> </div> diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 426415fc..bdf9903b 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -62,9 +62,7 @@ class DiffManager { } private escapeFilepath(filepath: string): string { - return filepath - .replace(/\//g, "$forwardslash$") - .replace(/\\/g, "$backslash$"); + return filepath.replace(/\//g, "$f$").replace(/\\/g, "$b$"); } private remoteTmpDir: string = "/tmp/continue"; |