From 8db3dcb7b9f138b09d7cceedfa830fd150795b30 Mon Sep 17 00:00:00 2001
From: Nate Sesti <sestinj@gmail.com>
Date: Sun, 25 Jun 2023 13:44:31 -0700
Subject: don't call python function, other

---
 extension/react-app/src/components/HeaderButtonWithText.tsx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'extension/react-app/src/components/HeaderButtonWithText.tsx')

diff --git a/extension/react-app/src/components/HeaderButtonWithText.tsx b/extension/react-app/src/components/HeaderButtonWithText.tsx
index acaca9ce..5901c5d8 100644
--- a/extension/react-app/src/components/HeaderButtonWithText.tsx
+++ b/extension/react-app/src/components/HeaderButtonWithText.tsx
@@ -6,12 +6,14 @@ interface HeaderButtonWithTextProps {
   text: string;
   onClick?: (e: any) => void;
   children: React.ReactNode;
+  disabled?: boolean;
 }
 
 const HeaderButtonWithText = (props: HeaderButtonWithTextProps) => {
   const [hover, setHover] = useState(false);
   return (
     <HeaderButton
+      disabled={props.disabled}
       style={{ padding: "1px", paddingLeft: hover ? "4px" : "1px" }}
       onMouseEnter={() => setHover(true)}
       onMouseLeave={() => {
-- 
cgit v1.2.3-70-g09d2


From 3fa2220379f07b162b9c72d1e0d6c13e0d59b8d9 Mon Sep 17 00:00:00 2001
From: Nate Sesti <sestinj@gmail.com>
Date: Sun, 25 Jun 2023 15:14:56 -0700
Subject: shipped function calling

---
 continuedev/src/continuedev/core/autopilot.py      |  14 ++++++++-
 continuedev/src/continuedev/steps/chat.py          |  33 +++++++++++----------
 extension/package-lock.json                        |   4 +--
 extension/package.json                             |   2 +-
 .../src/components/HeaderButtonWithText.tsx        |   6 +++-
 extension/react-app/src/tabs/gui.tsx               |   2 --
 .../scripts/continuedev-0.1.1-py3-none-any.whl     | Bin 86716 -> 89177 bytes
 7 files changed, 39 insertions(+), 22 deletions(-)

(limited to 'extension/react-app/src/components/HeaderButtonWithText.tsx')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index f14a4127..04f64ed8 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -15,6 +15,17 @@ from .sdk import ContinueSDK
 import asyncio
 from ..libs.util.step_name_to_steps import get_step_from_name
 from ..libs.util.traceback_parsers import get_python_traceback, get_javascript_traceback
+from openai import error as openai_errors
+
+
+def get_error_title(e: Exception) -> str:
+    if isinstance(e, openai_errors.APIError):
+        return "OpenAI is overloaded with requests. Please try again."
+    elif isinstance(e, openai_errors.RateLimitError):
+        return "This OpenAI API key has been rate limited. Please try again."
+    elif isinstance(e, openai_errors.Timeout):
+        return "OpenAI timed out. Please try again."
+    return e.__repr__()
 
 
 class Autopilot(ContinueBaseModel):
@@ -166,7 +177,8 @@ class Autopilot(ContinueBaseModel):
 
             error_string = e.message if is_continue_custom_exception else '\n\n'.join(
                 traceback.format_tb(e.__traceback__)) + f"\n\n{e.__repr__()}"
-            error_title = e.title if is_continue_custom_exception else e.__repr__()
+            error_title = e.title if is_continue_custom_exception else get_error_title(
+                e)
 
             # Attach an InternalErrorObservation to the step and unhide it.
             print(f"Error while running step: \n{error_string}\n{error_title}")
diff --git a/continuedev/src/continuedev/steps/chat.py b/continuedev/src/continuedev/steps/chat.py
index a940c3ba..2a8ae2da 100644
--- a/continuedev/src/continuedev/steps/chat.py
+++ b/continuedev/src/continuedev/steps/chat.py
@@ -182,21 +182,24 @@ class ChatWithFunctions(Step):
             else:
                 if func_name == "python" and "python" not in step_name_step_class_map:
                     # GPT must be fine-tuned to believe this exists, but it doesn't always
-                    self.chat_context.append(ChatMessage(
-                        role="assistant",
-                        content=None,
-                        function_call=FunctionCall(
-                            name=func_name,
-                            arguments=func_args
-                        ),
-                        summary=f"Ran function {func_name}"
-                    ))
-                    self.chat_context.append(ChatMessage(
-                        role="user",
-                        content="The 'python' function does not exist. Don't call it.",
-                        summary="'python' function does not exist."
-                    ))
-                    continue
+                    func_name = "EditHighlightedCodeStep"
+                    func_args = json.dumps({"user_input": self.user_input})
+                    # self.chat_context.append(ChatMessage(
+                    #     role="assistant",
+                    #     content=None,
+                    #     function_call=FunctionCall(
+                    #         name=func_name,
+                    #         arguments=func_args
+                    #     ),
+                    #     summary=f"Ran function {func_name}"
+                    # ))
+                    # self.chat_context.append(ChatMessage(
+                    #     role="user",
+                    #     content="The 'python' function does not exist. Don't call it. Try again to call another function.",
+                    #     summary="'python' function does not exist."
+                    # ))
+                    # msg_step.hide = True
+                    # continue
                 # Call the function, then continue to chat
                 func_args = "{}" if func_args == "" else func_args
                 fn_call_params = json.loads(func_args)
diff --git a/extension/package-lock.json b/extension/package-lock.json
index 12b2fe13..71edfe8c 100644
--- a/extension/package-lock.json
+++ b/extension/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "continue",
-  "version": "0.0.61",
+  "version": "0.0.62",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "continue",
-      "version": "0.0.61",
+      "version": "0.0.62",
       "license": "Apache-2.0",
       "dependencies": {
         "@electron/rebuild": "^3.2.10",
diff --git a/extension/package.json b/extension/package.json
index 9fd1d7a6..9679b159 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -14,7 +14,7 @@
   "displayName": "Continue",
   "pricing": "Free",
   "description": "Accelerating software development with language models",
-  "version": "0.0.61",
+  "version": "0.0.62",
   "publisher": "Continue",
   "engines": {
     "vscode": "^1.74.0"
diff --git a/extension/react-app/src/components/HeaderButtonWithText.tsx b/extension/react-app/src/components/HeaderButtonWithText.tsx
index 5901c5d8..30931f86 100644
--- a/extension/react-app/src/components/HeaderButtonWithText.tsx
+++ b/extension/react-app/src/components/HeaderButtonWithText.tsx
@@ -15,7 +15,11 @@ const HeaderButtonWithText = (props: HeaderButtonWithTextProps) => {
     <HeaderButton
       disabled={props.disabled}
       style={{ padding: "1px", paddingLeft: hover ? "4px" : "1px" }}
-      onMouseEnter={() => setHover(true)}
+      onMouseEnter={() => {
+        if (!props.disabled) {
+          setHover(true);
+        }
+      }}
       onMouseLeave={() => {
         setHover(false);
       }}
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 5001fe4b..4886bfad 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -491,8 +491,6 @@ function GUI(props: GUIProps) {
         <HeaderButtonWithText
           onClick={() => {
             client?.sendClear();
-            // Reload the window to get completely fresh session
-            window.location.reload();
           }}
           text="Clear All"
         >
diff --git a/extension/scripts/continuedev-0.1.1-py3-none-any.whl b/extension/scripts/continuedev-0.1.1-py3-none-any.whl
index 29e41d3c..692bdfb7 100644
Binary files a/extension/scripts/continuedev-0.1.1-py3-none-any.whl and b/extension/scripts/continuedev-0.1.1-py3-none-any.whl differ
-- 
cgit v1.2.3-70-g09d2

