From 1e1012a2cd8537af1ba1a65227a6473da44a2578 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 15:02:20 -0700
Subject: removing captured terminal

---
 extension/src/activation/activate.ts | 37 +++---------------------------------
 extension/src/commands.ts            |  5 -----
 extension/src/continueIdeClient.ts   | 14 +++-----------
 3 files changed, 6 insertions(+), 50 deletions(-)

(limited to 'extension')

diff --git a/extension/src/activation/activate.ts b/extension/src/activation/activate.ts
index 32726c86..34abdff7 100644
--- a/extension/src/activation/activate.ts
+++ b/extension/src/activation/activate.ts
@@ -8,7 +8,7 @@ import * as path from "path";
 import IdeProtocolClient from "../continueIdeClient";
 import { getContinueServerUrl } from "../bridge";
 import { setupDebugPanel, ContinueGUIWebviewViewProvider } from "../debugPanel";
-import { CapturedTerminal } from "../terminal/terminalEmulator";
+// import { CapturedTerminal } from "../terminal/terminalEmulator";
 
 export let extensionContext: vscode.ExtensionContext | undefined = undefined;
 
@@ -49,41 +49,10 @@ export function activateExtension(
   })();
 
   // All opened terminals should be replaced by our own terminal
-  vscode.window.onDidOpenTerminal((terminal) => {
-    if (terminal.name === "Continue") {
-      return;
-    }
-    const options = terminal.creationOptions;
-    const capturedTerminal = new CapturedTerminal({
-      ...options,
-      name: "Continue",
-    });
-    terminal.dispose();
-    if (!ideProtocolClient.continueTerminal) {
-      ideProtocolClient.continueTerminal = capturedTerminal;
-    }
-  });
+  // vscode.window.onDidOpenTerminal((terminal) => {});
 
   // If any terminals are open to start, replace them
-  vscode.window.terminals.forEach((terminal) => {
-    if (terminal.name === "Continue") {
-      return;
-    }
-    const options = terminal.creationOptions;
-    const capturedTerminal = new CapturedTerminal(
-      {
-        ...options,
-        name: "Continue",
-      },
-      (commandOutput: string) => {
-        ideProtocolClient.sendCommandOutput(commandOutput);
-      }
-    );
-    terminal.dispose();
-    if (!ideProtocolClient.continueTerminal) {
-      ideProtocolClient.continueTerminal = capturedTerminal;
-    }
-  });
+  // vscode.window.terminals.forEach((terminal) => {}
 
   extensionContext = context;
 }
diff --git a/extension/src/commands.ts b/extension/src/commands.ts
index 22e15c43..291a3ceb 100644
--- a/extension/src/commands.ts
+++ b/extension/src/commands.ts
@@ -13,7 +13,6 @@ import {
 } from "./suggestions";
 import * as bridge from "./bridge";
 import { debugPanelWebview, setupDebugPanel } from "./debugPanel";
-// import { openCapturedTerminal } from "./terminal/terminalEmulator";
 import { getRightViewColumn } from "./util/vscode";
 import {
   findSuspiciousCode,
@@ -67,10 +66,6 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
       type: "focusContinueInput",
     });
   },
-  "continue.openCapturedTerminal": () => {
-    // Happens in webview resolution function
-    // openCapturedTerminal();
-  },
   "continue.findSuspiciousCode": async (
     debugContext: SerializedDebugContext
   ) => {
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index fbad5f5d..202077de 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -12,7 +12,6 @@ import { debugPanelWebview, setupDebugPanel } from "./debugPanel";
 import { FileEditWithFullContents } from "../schema/FileEditWithFullContents";
 import fs = require("fs");
 import { WebsocketMessenger } from "./util/messenger";
-import { CapturedTerminal } from "./terminal/terminalEmulator";
 import { decorationManager } from "./decorations";
 
 class IdeProtocolClient {
@@ -326,17 +325,10 @@ class IdeProtocolClient {
     return rangeInFiles;
   }
 
-  public continueTerminal: CapturedTerminal | undefined;
-
   async runCommand(command: string) {
-    if (!this.continueTerminal || this.continueTerminal.isClosed()) {
-      this.continueTerminal = new CapturedTerminal({
-        name: "Continue",
-      });
-    }
-
-    this.continueTerminal.show();
-    return await this.continueTerminal.runCommand(command);
+    const terminal = vscode.window.createTerminal();
+    terminal.show();
+    terminal.sendText(command);
   }
 
   sendCommandOutput(output: string) {
-- 
cgit v1.2.3-70-g09d2


From 2dd87605a05236c1dd10389883766f4c51207d56 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 15:25:49 -0700
Subject: initial ideas

---
 continuedev/src/continuedev/core/autopilot.py           | 4 ++++
 continuedev/src/continuedev/server/gui.py               | 3 +++
 continuedev/src/continuedev/server/gui_protocol.py      | 4 ++++
 extension/react-app/src/hooks/useContinueGUIProtocol.ts | 4 ++++
 extension/react-app/src/tabs/gui.tsx                    | 4 ++--
 5 files changed, 17 insertions(+), 2 deletions(-)

(limited to 'extension')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index a6e688ae..2ed77e4d 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -45,6 +45,10 @@ class Autopilot(ContinueBaseModel):
     async def get_available_slash_commands(self) -> List[Dict]:
         return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
 
+    async def change_default_model(self):
+        # TODO: Implement this
+        temp = self.continue_sdk.config.slash_commands
+
     async def clear_history(self):
         self.history = History.from_empty()
         self._main_user_input_queue = []
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py
index cf046734..53a5f16b 100644
--- a/continuedev/src/continuedev/server/gui.py
+++ b/continuedev/src/continuedev/server/gui.py
@@ -116,6 +116,9 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
         asyncio.create_task(
             self.session.autopilot.retry_at_index(index))
 
+    def on_change_default_model(self):
+        asyncio.create_task(self.session.autopilot.change_default_model())
+
     def on_clear_history(self):
         asyncio.create_task(self.session.autopilot.clear_history())
 
diff --git a/continuedev/src/continuedev/server/gui_protocol.py b/continuedev/src/continuedev/server/gui_protocol.py
index d9506c6f..66839d9b 100644
--- a/continuedev/src/continuedev/server/gui_protocol.py
+++ b/continuedev/src/continuedev/server/gui_protocol.py
@@ -35,6 +35,10 @@ class AbstractGUIProtocolServer(ABC):
     def on_retry_at_index(self, index: int):
         """Called when the user requests a retry at a previous index"""
 
+    @abstractmethod
+    def on_change_default_model(self):
+        """Called when the user requests to change the default model"""
+
     @abstractmethod
     def on_clear_history(self):
         """Called when the user requests to clear the history"""
diff --git a/extension/react-app/src/hooks/useContinueGUIProtocol.ts b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
index 59397742..4eb68046 100644
--- a/extension/react-app/src/hooks/useContinueGUIProtocol.ts
+++ b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
@@ -55,6 +55,10 @@ class ContinueGUIClientProtocol extends AbstractContinueGUIClientProtocol {
     });
   }
 
+  changeDefaultModel() {
+    this.messenger.send("change_default_model", {});
+  }
+
   sendClear() {
     this.messenger.send("clear_history", {});
   }
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index f0e3ffd4..15260e0c 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -470,7 +470,7 @@ function GUI(props: GUIProps) {
             Contribute Data
           </span>
         </div>
-        {/* <HeaderButtonWithText
+        { <HeaderButtonWithText
           onClick={() => {
             setUsingFastModel((prev) => !prev);
           }}
@@ -481,7 +481,7 @@ function GUI(props: GUIProps) {
           >
             {usingFastModel ? "⚡" : "🧠"}
           </div>
-        </HeaderButtonWithText> */}
+        </HeaderButtonWithText>}
         <HeaderButtonWithText
           onClick={() => {
             client?.sendClear();
-- 
cgit v1.2.3-70-g09d2


From 0eceef43ae9d0e0e195a9dbbe1e038b4e02ea61b Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 15:28:37 -0700
Subject: Revert "initial ideas"

This reverts commit 2dd87605a05236c1dd10389883766f4c51207d56.
---
 continuedev/src/continuedev/core/autopilot.py           | 4 ----
 continuedev/src/continuedev/server/gui.py               | 3 ---
 continuedev/src/continuedev/server/gui_protocol.py      | 4 ----
 extension/react-app/src/hooks/useContinueGUIProtocol.ts | 4 ----
 extension/react-app/src/tabs/gui.tsx                    | 4 ++--
 5 files changed, 2 insertions(+), 17 deletions(-)

(limited to 'extension')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index 2ed77e4d..a6e688ae 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -45,10 +45,6 @@ class Autopilot(ContinueBaseModel):
     async def get_available_slash_commands(self) -> List[Dict]:
         return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
 
-    async def change_default_model(self):
-        # TODO: Implement this
-        temp = self.continue_sdk.config.slash_commands
-
     async def clear_history(self):
         self.history = History.from_empty()
         self._main_user_input_queue = []
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py
index 53a5f16b..cf046734 100644
--- a/continuedev/src/continuedev/server/gui.py
+++ b/continuedev/src/continuedev/server/gui.py
@@ -116,9 +116,6 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
         asyncio.create_task(
             self.session.autopilot.retry_at_index(index))
 
-    def on_change_default_model(self):
-        asyncio.create_task(self.session.autopilot.change_default_model())
-
     def on_clear_history(self):
         asyncio.create_task(self.session.autopilot.clear_history())
 
diff --git a/continuedev/src/continuedev/server/gui_protocol.py b/continuedev/src/continuedev/server/gui_protocol.py
index 66839d9b..d9506c6f 100644
--- a/continuedev/src/continuedev/server/gui_protocol.py
+++ b/continuedev/src/continuedev/server/gui_protocol.py
@@ -35,10 +35,6 @@ class AbstractGUIProtocolServer(ABC):
     def on_retry_at_index(self, index: int):
         """Called when the user requests a retry at a previous index"""
 
-    @abstractmethod
-    def on_change_default_model(self):
-        """Called when the user requests to change the default model"""
-
     @abstractmethod
     def on_clear_history(self):
         """Called when the user requests to clear the history"""
diff --git a/extension/react-app/src/hooks/useContinueGUIProtocol.ts b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
index 4eb68046..59397742 100644
--- a/extension/react-app/src/hooks/useContinueGUIProtocol.ts
+++ b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
@@ -55,10 +55,6 @@ class ContinueGUIClientProtocol extends AbstractContinueGUIClientProtocol {
     });
   }
 
-  changeDefaultModel() {
-    this.messenger.send("change_default_model", {});
-  }
-
   sendClear() {
     this.messenger.send("clear_history", {});
   }
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 15260e0c..f0e3ffd4 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -470,7 +470,7 @@ function GUI(props: GUIProps) {
             Contribute Data
           </span>
         </div>
-        { <HeaderButtonWithText
+        {/* <HeaderButtonWithText
           onClick={() => {
             setUsingFastModel((prev) => !prev);
           }}
@@ -481,7 +481,7 @@ function GUI(props: GUIProps) {
           >
             {usingFastModel ? "⚡" : "🧠"}
           </div>
-        </HeaderButtonWithText>}
+        </HeaderButtonWithText> */}
         <HeaderButtonWithText
           onClick={() => {
             client?.sendClear();
-- 
cgit v1.2.3-70-g09d2


From 6cedd587c6c62bf33349e374aafa83fdc78da510 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 15:36:12 -0700
Subject: initial ideas

---
 continuedev/src/continuedev/core/autopilot.py           | 4 ++++
 continuedev/src/continuedev/server/gui.py               | 3 +++
 continuedev/src/continuedev/server/gui_protocol.py      | 4 ++++
 extension/react-app/src/hooks/useContinueGUIProtocol.ts | 4 ++++
 extension/react-app/src/tabs/gui.tsx                    | 4 ++--
 5 files changed, 17 insertions(+), 2 deletions(-)

(limited to 'extension')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index a6e688ae..2ed77e4d 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -45,6 +45,10 @@ class Autopilot(ContinueBaseModel):
     async def get_available_slash_commands(self) -> List[Dict]:
         return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
 
+    async def change_default_model(self):
+        # TODO: Implement this
+        temp = self.continue_sdk.config.slash_commands
+
     async def clear_history(self):
         self.history = History.from_empty()
         self._main_user_input_queue = []
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py
index cf046734..53a5f16b 100644
--- a/continuedev/src/continuedev/server/gui.py
+++ b/continuedev/src/continuedev/server/gui.py
@@ -116,6 +116,9 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
         asyncio.create_task(
             self.session.autopilot.retry_at_index(index))
 
+    def on_change_default_model(self):
+        asyncio.create_task(self.session.autopilot.change_default_model())
+
     def on_clear_history(self):
         asyncio.create_task(self.session.autopilot.clear_history())
 
diff --git a/continuedev/src/continuedev/server/gui_protocol.py b/continuedev/src/continuedev/server/gui_protocol.py
index d9506c6f..66839d9b 100644
--- a/continuedev/src/continuedev/server/gui_protocol.py
+++ b/continuedev/src/continuedev/server/gui_protocol.py
@@ -35,6 +35,10 @@ class AbstractGUIProtocolServer(ABC):
     def on_retry_at_index(self, index: int):
         """Called when the user requests a retry at a previous index"""
 
+    @abstractmethod
+    def on_change_default_model(self):
+        """Called when the user requests to change the default model"""
+
     @abstractmethod
     def on_clear_history(self):
         """Called when the user requests to clear the history"""
diff --git a/extension/react-app/src/hooks/useContinueGUIProtocol.ts b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
index 59397742..4eb68046 100644
--- a/extension/react-app/src/hooks/useContinueGUIProtocol.ts
+++ b/extension/react-app/src/hooks/useContinueGUIProtocol.ts
@@ -55,6 +55,10 @@ class ContinueGUIClientProtocol extends AbstractContinueGUIClientProtocol {
     });
   }
 
+  changeDefaultModel() {
+    this.messenger.send("change_default_model", {});
+  }
+
   sendClear() {
     this.messenger.send("clear_history", {});
   }
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index f0e3ffd4..cbc0e8af 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -470,7 +470,7 @@ function GUI(props: GUIProps) {
             Contribute Data
           </span>
         </div>
-        {/* <HeaderButtonWithText
+        <HeaderButtonWithText
           onClick={() => {
             setUsingFastModel((prev) => !prev);
           }}
@@ -481,7 +481,7 @@ function GUI(props: GUIProps) {
           >
             {usingFastModel ? "⚡" : "🧠"}
           </div>
-        </HeaderButtonWithText> */}
+        </HeaderButtonWithText>
         <HeaderButtonWithText
           onClick={() => {
             client?.sendClear();
-- 
cgit v1.2.3-70-g09d2


From 8c8e65f552d35679e2d5feb142f01f8a97801d20 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 21:33:24 -0700
Subject: more progress

---
 continuedev/src/continuedev/core/autopilot.py              | 7 +++++--
 continuedev/src/continuedev/server/gui.py                  | 2 ++
 extension/react-app/src/hooks/ContinueGUIClientProtocol.ts | 2 ++
 extension/react-app/src/tabs/gui.tsx                       | 1 +
 4 files changed, 10 insertions(+), 2 deletions(-)

(limited to 'extension')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index 2ed77e4d..0b4b9b12 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -46,8 +46,11 @@ class Autopilot(ContinueBaseModel):
         return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
 
     async def change_default_model(self):
-        # TODO: Implement this
-        temp = self.continue_sdk.config.slash_commands
+        print("Changing default model")
+        if self.continue_sdk.config.default_model == "gpt-4":
+            self.continue_sdk.config.default_model == "gpt-3.5-turbo" # not quite correct
+        else:
+            self.continue_sdk.config.default_model == "gpt-4" # not quite correct
 
     async def clear_history(self):
         self.history = History.from_empty()
diff --git a/continuedev/src/continuedev/server/gui.py b/continuedev/src/continuedev/server/gui.py
index 53a5f16b..9b36c704 100644
--- a/continuedev/src/continuedev/server/gui.py
+++ b/continuedev/src/continuedev/server/gui.py
@@ -77,6 +77,8 @@ class GUIProtocolServer(AbstractGUIProtocolServer):
                 self.on_reverse_to_index(data["index"])
             elif message_type == "retry_at_index":
                 self.on_retry_at_index(data["index"])
+            elif message_type == "change_default_model":
+                self.on_change_default_model()
             elif message_type == "clear_history":
                 self.on_clear_history()
             elif message_type == "delete_at_index":
diff --git a/extension/react-app/src/hooks/ContinueGUIClientProtocol.ts b/extension/react-app/src/hooks/ContinueGUIClientProtocol.ts
index 824bb086..6d9d1fdd 100644
--- a/extension/react-app/src/hooks/ContinueGUIClientProtocol.ts
+++ b/extension/react-app/src/hooks/ContinueGUIClientProtocol.ts
@@ -13,6 +13,8 @@ abstract class AbstractContinueGUIClientProtocol {
     callback: (commands: { name: string; description: string }[]) => void
   ): void;
 
+  abstract changeDefaultModel(): void;
+
   abstract sendClear(): void;
 
   abstract retryAtIndex(index: number): void;
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index cbc0e8af..15121010 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -473,6 +473,7 @@ function GUI(props: GUIProps) {
         <HeaderButtonWithText
           onClick={() => {
             setUsingFastModel((prev) => !prev);
+            client?.changeDefaultModel();
           }}
           text={usingFastModel ? "gpt-3.5-turbo" : "gpt-4"}
         >
-- 
cgit v1.2.3-70-g09d2


From 0fc6e9c3e3c8117fd29c8fefd3134cf45f043b85 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Wed, 21 Jun 2023 21:36:24 -0700
Subject: run existing terminal if possible

---
 extension/src/continueIdeClient.ts | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'extension')

diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 202077de..3a77e348 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -326,9 +326,13 @@ class IdeProtocolClient {
   }
 
   async runCommand(command: string) {
-    const terminal = vscode.window.createTerminal();
-    terminal.show();
-    terminal.sendText(command);
+    if (vscode.window.terminals.length) {
+      vscode.window.terminals[0].sendText(command);
+    } else {
+        const terminal = vscode.window.createTerminal();
+        terminal.show();
+        terminal.sendText(command);
+    }
   }
 
   sendCommandOutput(output: string) {
-- 
cgit v1.2.3-70-g09d2


From 8bc0c8d23469c1d1e7e20114f27dca876a3b0383 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Thu, 22 Jun 2023 12:39:01 -0700
Subject: start of syncing back

---
 continuedev/src/continuedev/core/autopilot.py |  8 ++----
 continuedev/src/continuedev/core/config.py    | 35 +++++++++++++++++++++++++++
 continuedev/src/continuedev/core/main.py      |  1 +
 continuedev/src/continuedev/core/sdk.py       | 11 ++++++++-
 extension/react-app/src/tabs/gui.tsx          |  1 +
 5 files changed, 49 insertions(+), 7 deletions(-)

(limited to 'extension')

diff --git a/continuedev/src/continuedev/core/autopilot.py b/continuedev/src/continuedev/core/autopilot.py
index 0b4b9b12..ab7f4747 100644
--- a/continuedev/src/continuedev/core/autopilot.py
+++ b/continuedev/src/continuedev/core/autopilot.py
@@ -40,17 +40,13 @@ class Autopilot(ContinueBaseModel):
         keep_untouched = (cached_property,)
 
     def get_full_state(self) -> FullState:
-        return FullState(history=self.history, active=self._active, user_input_queue=self._main_user_input_queue)
+        return FullState(history=self.history, active=self._active, user_input_queue=self._main_user_input_queue, default_model=self.continue_sdk.config.default_model)
 
     async def get_available_slash_commands(self) -> List[Dict]:
         return list(map(lambda x: {"name": x.name, "description": x.description}, self.continue_sdk.config.slash_commands)) or []
 
     async def change_default_model(self):
-        print("Changing default model")
-        if self.continue_sdk.config.default_model == "gpt-4":
-            self.continue_sdk.config.default_model == "gpt-3.5-turbo" # not quite correct
-        else:
-            self.continue_sdk.config.default_model == "gpt-4" # not quite correct
+        self.continue_sdk.update_default_model()
 
     async def clear_history(self):
         self.history = History.from_empty()
diff --git a/continuedev/src/continuedev/core/config.py b/continuedev/src/continuedev/core/config.py
index 652320fb..21d21879 100644
--- a/continuedev/src/continuedev/core/config.py
+++ b/continuedev/src/continuedev/core/config.py
@@ -86,3 +86,38 @@ def load_config(config_file: str) -> ContinueConfig:
     else:
         raise ValueError(f'Unknown config file extension: {ext}')
     return ContinueConfig(**config_dict)
+
+def update_config(config_file: str):
+    """
+    Update the config file with the current ContinueConfig object.
+    """
+    if not os.path.exists(config_file):
+        with open(config_file, 'w') as f:
+            config_dict = { "default_model": "gpt-3.5-turbo" }
+            json.dump(config_dict, f, indent=4)
+
+    _, ext = os.path.splitext(config_file)
+    if ext == '.yaml':
+
+        with open(config_file, 'w') as f:
+            config_dict = yaml.safe_load(f)
+
+            if config_dict["default_model"] == "gpt-4":
+                config_dict["default_model"] = "gpt-3.5-turbo"
+            else:
+                config_dict["default_model"] = "gpt-4"
+            
+            with open(config_file, 'w') as f:
+                json.dump(config_dict, f, indent=4)
+
+    elif ext == '.json':
+        with open(config_file, 'r') as f:
+            config_dict = json.load(f)
+
+        if config_dict["default_model"] == "gpt-4":
+            config_dict["default_model"] = "gpt-3.5-turbo"
+        else:
+            config_dict["default_model"] = "gpt-4"
+        
+        with open(config_file, 'w') as f:
+            json.dump(config_dict, f, indent=4)
\ No newline at end of file
diff --git a/continuedev/src/continuedev/core/main.py b/continuedev/src/continuedev/core/main.py
index efb91488..d6412ece 100644
--- a/continuedev/src/continuedev/core/main.py
+++ b/continuedev/src/continuedev/core/main.py
@@ -114,6 +114,7 @@ class FullState(ContinueBaseModel):
     history: History
     active: bool
     user_input_queue: List[str]
+    default_model: str
 
 
 class ContinueSDK:
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index d6acc404..5652ec39 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -6,7 +6,7 @@ import os
 from ..steps.core.core import DefaultModelEditCodeStep
 from ..models.main import Range
 from .abstract_sdk import AbstractContinueSDK
-from .config import ContinueConfig, load_config
+from .config import ContinueConfig, load_config, update_config
 from ..models.filesystem_edit import FileEdit, FileSystemEdit, AddFile, DeleteFile, AddDirectory, DeleteDirectory
 from ..models.filesystem import RangeInFile
 from ..libs.llm.hf_inference_api import HuggingFaceInferenceAPI
@@ -170,6 +170,15 @@ class ContinueSDK(AbstractContinueSDK):
         else:
             return ContinueConfig()
 
+    def update_default_model(self):
+        dir = self.ide.workspace_directory
+        yaml_path = os.path.join(dir, '.continue', 'config.yaml')
+        json_path = os.path.join(dir, '.continue', 'config.json')
+        if os.path.exists(yaml_path):
+            update_config(yaml_path)
+        else:
+            update_config(json_path)
+
     def set_loading_message(self, message: str):
         # self.__autopilot.set_loading_message(message)
         raise NotImplementedError()
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 15121010..0dd7e3ec 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -230,6 +230,7 @@ function GUI(props: GUIProps) {
     console.log("CLIENT ON STATE UPDATE: ", client, client?.onStateUpdate);
     client?.onStateUpdate((state) => {
       // Scroll only if user is at very bottom of the window.
+      setUsingFastModel(state.using_fast_model);
       const shouldScrollToBottom =
         topGuiDivRef.current &&
         topGuiDivRef.current?.offsetHeight - window.scrollY < 100;
-- 
cgit v1.2.3-70-g09d2


From 71f8e361117ea5b4d88cc5c94e2e54a8ac5f2bf8 Mon Sep 17 00:00:00 2001
From: Ty Dunn <ty@tydunn.com>
Date: Thu, 22 Jun 2023 13:04:04 -0700
Subject: adding default model

---
 extension/react-app/src/tabs/gui.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'extension')

diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 0dd7e3ec..16c950ef 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -230,7 +230,7 @@ function GUI(props: GUIProps) {
     console.log("CLIENT ON STATE UPDATE: ", client, client?.onStateUpdate);
     client?.onStateUpdate((state) => {
       // Scroll only if user is at very bottom of the window.
-      setUsingFastModel(state.using_fast_model);
+      setUsingFastModel(state.default_model === "gpt-3.5-turbo");
       const shouldScrollToBottom =
         topGuiDivRef.current &&
         topGuiDivRef.current?.offsetHeight - window.scrollY < 100;
-- 
cgit v1.2.3-70-g09d2