diff options
-rw-r--r-- | continuedev/src/continuedev/libs/llm/together.py | 24 | ||||
-rw-r--r-- | extension/react-app/src/App.tsx | 4 | ||||
-rw-r--r-- | extension/react-app/src/pages/gui.tsx | 1 |
3 files changed, 22 insertions, 7 deletions
diff --git a/continuedev/src/continuedev/libs/llm/together.py b/continuedev/src/continuedev/libs/llm/together.py index 1b91ec43..a9db70c6 100644 --- a/continuedev/src/continuedev/libs/llm/together.py +++ b/continuedev/src/continuedev/libs/llm/together.py @@ -3,6 +3,7 @@ from typing import Callable, Optional import aiohttp +from ...core.main import ContinueCustomException from ..llm import LLM from ..util.logging import logger from .prompts.chat import llama2_template_messages @@ -80,7 +81,22 @@ class TogetherLLM(LLM): ) as resp: text = await resp.text() j = json.loads(text) - if "choices" not in j["output"]: - raise Exception(text) - if "output" in j: - return j["output"]["choices"][0]["text"] + try: + if "choices" not in j["output"]: + raise Exception(text) + if "output" in j: + return j["output"]["choices"][0]["text"] + except Exception as e: + j = await resp.json() + if "error" in j: + if j["error"].startswith("invalid hexlify value"): + raise ContinueCustomException( + message=f"Invalid Together API key:\n\n{j['error']}", + title="Together API Error", + ) + else: + raise ContinueCustomException( + message=j["error"], title="Together API Error" + ) + + raise e diff --git a/extension/react-app/src/App.tsx b/extension/react-app/src/App.tsx index 65ad1ddd..edcac4a0 100644 --- a/extension/react-app/src/App.tsx +++ b/extension/react-app/src/App.tsx @@ -15,11 +15,11 @@ import { } from "./redux/slices/configSlice"; import { setHighlightedCode } from "./redux/slices/miscSlice"; import { postVscMessage } from "./vscode"; -import { createBrowserRouter, RouterProvider } from "react-router-dom"; +import { RouterProvider, createMemoryRouter } from "react-router-dom"; import ErrorPage from "./pages/error"; import SettingsPage from "./pages/settings"; -const router = createBrowserRouter([ +const router = createMemoryRouter([ { path: "/", element: <Layout />, diff --git a/extension/react-app/src/pages/gui.tsx b/extension/react-app/src/pages/gui.tsx index 3d98522a..c4e13d2a 100644 --- a/extension/react-app/src/pages/gui.tsx +++ b/extension/react-app/src/pages/gui.tsx @@ -378,7 +378,6 @@ function GUI(props: GUIProps) { }, []); return ( <div - className="overflow-scroll" ref={topGuiDivRef} onKeyDown={(e) => { if (e.key === "Enter" && e.ctrlKey) { |