diff --git a/core/core.ts b/core/core.ts
index 61da87d95..43c11a3e9 100644
--- a/core/core.ts
+++ b/core/core.ts
@@ -35,7 +35,7 @@ import { Telemetry } from "./util/posthog";
import { getSymbolsForManyFiles } from "./util/treeSitter";
import { TTS } from "./util/tts";
-import type { ContextItemId, IDE, IndexingProgressUpdate } from ".";
+import { type ContextItemId, type IDE, type IndexingProgressUpdate } from ".";
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
import type { IMessenger, Message } from "./protocol/messenger";
@@ -72,7 +72,7 @@ export class Core {
data: FromCoreProtocol[T][0],
messageId?: string,
): string {
- return this.messenger.send(messageType, data);
+ return this.messenger.send(messageType, data, messageId);
}
// TODO: It shouldn't actually need an IDE type, because this can happen
@@ -182,6 +182,8 @@ export class Core {
const on = this.messenger.on.bind(this.messenger);
+ // Note, VsCode's in-process messenger doesn't do anything with this
+ // It will only show for jetbrains
this.messenger.onError((err) => {
console.error(err);
void Telemetry.capture("core_messenger_error", {
diff --git a/core/util/constants.ts b/core/util/constants.ts
index 188fc0005..ea0d4b2d3 100644
--- a/core/util/constants.ts
+++ b/core/util/constants.ts
@@ -1 +1,5 @@
export const NEW_SESSION_TITLE = "New Session";
+
+export const GITHUB_LINK =
+ "https://github.com/continuedev/continue/issues/new/choose";
+export const DISCORD_LINK = "https://discord.com/invite/EfJEfdFnDQ";
diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts
index 3f201f016..b00c10049 100644
--- a/extensions/vscode/src/extension/VsCodeMessenger.ts
+++ b/extensions/vscode/src/extension/VsCodeMessenger.ts
@@ -415,11 +415,11 @@ export class VsCodeMessenger {
/** PASS THROUGH FROM WEBVIEW TO CORE AND BACK **/
WEBVIEW_TO_CORE_PASS_THROUGH.forEach((messageType) => {
this.onWebview(messageType, async (msg) => {
- return (await this.inProcessMessenger.externalRequest(
+ return await this.inProcessMessenger.externalRequest(
messageType,
msg.data,
msg.messageId,
- )) as TODO;
+ );
});
});
diff --git a/extensions/vscode/src/webviewProtocol.ts b/extensions/vscode/src/webviewProtocol.ts
index 1fc383fae..c639d0bf3 100644
--- a/extensions/vscode/src/webviewProtocol.ts
+++ b/extensions/vscode/src/webviewProtocol.ts
@@ -103,16 +103,21 @@ export class VsCodeWebviewProtocol
respond({ done: true, content: response || {}, status: "success" });
}
} catch (e: any) {
- respond({ done: true, error: e, status: "error" });
+ respond({ done: true, error: e.message, status: "error" });
+ const stringified = JSON.stringify({ msg }, null, 2);
console.error(
- `Error handling webview message: ${JSON.stringify(
- { msg },
- null,
- 2,
- )}\n\n${e}`,
+ `Error handling webview message: ${stringified}\n\n${e}`,
);
+ if (
+ stringified.includes("llm/streamChat") ||
+ stringified.includes("chatDescriber/describe")
+ ) {
+ // handle these errors in the GUI
+ return;
+ }
+
let message = e.message;
if (e.cause) {
if (e.cause.name === "ConnectTimeoutError") {
diff --git a/gui/src/context/IdeMessenger.ts b/gui/src/context/IdeMessenger.ts
index 8b47fbf9b..fc2b7ea20 100644
--- a/gui/src/context/IdeMessenger.ts
+++ b/gui/src/context/IdeMessenger.ts
@@ -76,8 +76,7 @@ export class IdeMessenger implements IIdeMessenger {
);
throw new Error("postIntellijMessage is undefined");
}
- messageId = messageId ?? uuidv4();
- window.postIntellijMessage?.(messageType, data, messageId);
+ window.postIntellijMessage?.(messageType, data, messageId ?? uuidv4());
return;
} else {
console.log(
@@ -235,6 +234,7 @@ export class IdeMessenger implements IIdeMessenger {
}
if (next.value.error) {
+ console.log("FROM IDEMESS", next.value);
throw new Error(next.value.error);
}
diff --git a/gui/src/pages/error.tsx b/gui/src/pages/error.tsx
index 0014a580e..92c064019 100644
--- a/gui/src/pages/error.tsx
+++ b/gui/src/pages/error.tsx
@@ -7,9 +7,7 @@ import { useContext, useEffect, useState } from "react";
import { IdeMessengerContext } from "../context/IdeMessenger";
import { Button, SecondaryButton } from "../components";
import { ArrowPathIcon, FlagIcon } from "@heroicons/react/24/outline";
-
-const GITHUB_LINK = "https://github.com/continuedev/continue/issues/new/choose";
-const DISCORD_LINK = "https://discord.com/invite/EfJEfdFnDQ";
+import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants";
const ErrorPage: React.FC = () => {
const error: any = useRouteError();
diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx
index 9f544bf40..4a45e44da 100644
--- a/gui/src/pages/gui/Chat.tsx
+++ b/gui/src/pages/gui/Chat.tsx
@@ -454,7 +454,11 @@ export function Chat() {
trackVisibility={isStreaming}
/>
-
+ {history.length > 0 ? (
+
+
+
+ ) : null}
{ttsActive && (
@@ -535,8 +539,12 @@ export function Chat() {
}}
/>
)}
+
{history.length === 0 && (
<>
+
+
+
{onboardingCard.show && (
@@ -552,9 +560,7 @@ export function Chat() {
)}
-
-
-
+
diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx
index b5db2489e..29bf81b13 100644
--- a/gui/src/pages/gui/StreamError.tsx
+++ b/gui/src/pages/gui/StreamError.tsx
@@ -1,12 +1,154 @@
-import { useAppSelector } from "../../redux/hooks";
+import { Cog8ToothIcon, XMarkIcon } from "@heroicons/react/24/outline";
+import { useAppDispatch, useAppSelector } from "../../redux/hooks";
+import { setStreamError } from "../../redux/slices/sessionSlice";
+import { useContext, useEffect, useMemo } from "react";
+import { GithubIcon } from "../../components/svg/GithubIcon";
+import { DiscordIcon } from "../../components/svg/DiscordIcon";
+import { IdeMessengerContext } from "../../context/IdeMessenger";
+import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants";
+import {
+ selectDefaultModel,
+ setDefaultModel,
+} from "../../redux/slices/configSlice";
+import { ToolTip } from "../../components/gui/Tooltip";
+import { providers } from "../AddNewModel/configs/providers";
+import { Button, SecondaryButton } from "../../components";
-const StreamError = () => {
+interface StreamErrorProps {
+ slideDirection: "up" | "down";
+}
+const StreamError = ({ slideDirection }: StreamErrorProps) => {
+ const dispatch = useAppDispatch();
+ const ideMessenger = useContext(IdeMessengerContext);
const streamError = useAppSelector((state) => state.session.streamError);
+ const selectedModel = useAppSelector(selectDefaultModel);
- if (streamError) {
- return null;
- }
- return
Hello
;
+ useEffect(() => {
+ dispatch(setStreamError(undefined));
+ }, [selectedModel]);
+
+ const errorContent = useMemo(() => {
+ // TODO use updated LLM-INFO strategy to get this info
+
+ let modelTitle = "Chat model";
+ let providerName = "the model provider";
+ let apiKeyUrl: string | undefined = undefined;
+ if (selectedModel) {
+ modelTitle = selectedModel.title;
+ providerName = selectedModel.provider;
+
+ // If there's a matching provider from add model form provider info
+ // We can get more info
+ const foundProvider = Object.values(providers).find(
+ (p) => p?.provider === selectedModel.provider,
+ );
+ if (foundProvider) {
+ providerName = foundProvider.title;
+ if (foundProvider.apiKeyUrl) {
+ apiKeyUrl = foundProvider.apiKeyUrl;
+ }
+ }
+ }
+ return streamError
+ ? ({
+ 429: (
+
+
+ {`${modelTitle} has been rate limited
+ by ${providerName}.`}
+
+ {apiKeyUrl ? (
+
+ ) : null}
+
+ ),
+ }[streamError.statusCode] ?? (
+
There was an error completing"
+ ))
+ : null;
+ }, [streamError, selectedModel]);
+
+ return (
+
+
+
+
Chat Error
+
{
+ dispatch(setStreamError(undefined));
+ }}
+ >
+
+
+
+
{errorContent}
+
+
+
{
+ ideMessenger.post("config/openProfile", {
+ profileId: undefined,
+ });
+ }}
+ >
+
+
+
+ Config
+
+
|
+
+
{
+ ideMessenger.post("toggleDevTools", undefined);
+ }}
+ >
+ Logs
+
+
|
+
Report:
+
+ {
+ ideMessenger.post("openUrl", GITHUB_LINK);
+ }}
+ />
+ Github
+
+
+ {
+ ideMessenger.post("openUrl", DISCORD_LINK);
+ }}
+ />
+ Discord
+
+
+
+
+
+ );
};
export default StreamError;
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts
index 8ce289eed..6b2afd56a 100644
--- a/gui/src/redux/slices/sessionSlice.ts
+++ b/gui/src/redux/slices/sessionSlice.ts
@@ -354,13 +354,12 @@ export const sessionSlice = createSlice({
},
setStreamError: (
state,
- { payload }: PayloadAction<{ statusCode: number; message: string }>,
+ {
+ payload,
+ }: PayloadAction<{ statusCode: number; message: string } | undefined>,
) => {
state.streamError = payload;
},
- clearStreamError: (state) => {
- state.streamError = undefined;
- },
newSession: (state, { payload }: PayloadAction
) => {
state.lastSessionId = state.id;
@@ -652,6 +651,7 @@ export const {
addSessionMetadata,
updateSessionMetadata,
deleteSessionMetadata,
+ setStreamError,
} = sessionSlice.actions;
export const {
diff --git a/gui/src/redux/thunks/streamThunkWrapper.ts b/gui/src/redux/thunks/streamThunkWrapper.ts
index 7b9000be8..f0e1c7bc2 100644
--- a/gui/src/redux/thunks/streamThunkWrapper.ts
+++ b/gui/src/redux/thunks/streamThunkWrapper.ts
@@ -1,5 +1,9 @@
import { createAsyncThunk } from "@reduxjs/toolkit";
-import { clearLastEmptyResponse, setInactive } from "../slices/sessionSlice";
+import {
+ clearLastEmptyResponse,
+ setInactive,
+ setStreamError,
+} from "../slices/sessionSlice";
import { ThunkApiType } from "../store";
import { saveCurrentSession } from "./session";
@@ -9,10 +13,24 @@ export const streamThunkWrapper = createAsyncThunk<
ThunkApiType
>("chat/streamWrapper", async (runStream, { dispatch, extra }) => {
try {
+ dispatch(setStreamError(undefined));
await runStream();
} catch (e: any) {
// NOTE - streaming errors are shown as ide toasts in core, don't show duplicate here
- console.debug("Error streaming response: ", e);
+ // console.debug("Error streaming response: ", e);
+ if (e.message) {
+ const status = e.message.split(" ")[0];
+ if (status) {
+ console.log("STATUS", status);
+ const statusCode = Number(status);
+ dispatch(
+ setStreamError({
+ message: e.message,
+ statusCode: Number.isNaN(statusCode) ? 500 : statusCode,
+ }),
+ );
+ }
+ }
dispatch(clearLastEmptyResponse());
} finally {
dispatch(setInactive());