diff --git a/gui/src/components/dialogs/index.tsx b/gui/src/components/dialogs/index.tsx
index c49b47721..5acf040b6 100644
--- a/gui/src/components/dialogs/index.tsx
+++ b/gui/src/components/dialogs/index.tsx
@@ -6,7 +6,6 @@ import {
CloseButton,
VSC_BACKGROUND_VAR,
defaultBorderRadius,
- lightGray,
parseColorForHex,
vscBackground,
vscForeground,
@@ -38,7 +37,7 @@ const DialogContainer = styled.div`
border-radius: ${defaultBorderRadius};
display: flex;
flex-direction: column;
- border: 1px solid ${lightGray};
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
word-wrap: break-word;
`;
diff --git a/gui/src/pages/gui/ModelsAddOnLimitDialog.tsx b/gui/src/pages/gui/ModelsAddOnLimitDialog.tsx
new file mode 100644
index 000000000..3f38623f8
--- /dev/null
+++ b/gui/src/pages/gui/ModelsAddOnLimitDialog.tsx
@@ -0,0 +1,44 @@
+import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants";
+import { useContext } from "react";
+import { SecondaryButton } from "../../components";
+import { DiscordIcon } from "../../components/svg/DiscordIcon";
+import { GithubIcon } from "../../components/svg/GithubIcon";
+import { IdeMessengerContext } from "../../context/IdeMessenger";
+
+export function ModelsAddOnLimitDialog() {
+ const ideMessenger = useContext(IdeMessengerContext);
+
+ return (
+
+
Models Add-On Limit Reached
+
+
+
+ You have reached the monthly limit for chat requests with the Models
+ Add-On. This limit exists to avoid abuse, but if this happened from
+ normal usage we encourage you to contact us on GitHub or Discord
+
+
+ {
+ ideMessenger.post("openUrl", GITHUB_LINK);
+ }}
+ >
+
+ Github
+
+ {
+ ideMessenger.post("openUrl", DISCORD_LINK);
+ }}
+ >
+
+ Discord
+
+
+
+
+ );
+}
diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx
index 35fe3dc91..d098d2bc4 100644
--- a/gui/src/pages/gui/StreamError.tsx
+++ b/gui/src/pages/gui/StreamError.tsx
@@ -1,6 +1,9 @@
-import { Cog8ToothIcon } from "@heroicons/react/24/outline";
+import {
+ ArrowTopRightOnSquareIcon,
+ Cog8ToothIcon,
+} from "@heroicons/react/24/outline";
import { DISCORD_LINK, GITHUB_LINK } from "core/util/constants";
-import { useContext } from "react";
+import { useContext, useMemo } from "react";
import { Button, SecondaryButton } from "../../components";
import { DiscordIcon } from "../../components/svg/DiscordIcon";
import { GithubIcon } from "../../components/svg/GithubIcon";
@@ -13,10 +16,22 @@ import { selectSelectedChatModel } from "../../redux/slices/configSlice";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { isLocalProfile } from "../../util";
import { providers } from "../AddNewModel/configs/providers";
+import { ModelsAddOnLimitDialog } from "./ModelsAddOnLimitDialog";
interface StreamErrorProps {
error: unknown;
}
+
+function parseErrorMessage(fullErrMsg: string): string {
+ const msg = fullErrMsg.split("\n\n").slice(1).join("\n\n");
+ try {
+ const parsed = JSON.parse(msg);
+ return parsed.error ?? parsed.message ?? msg;
+ } catch (e) {
+ return msg;
+ }
+}
+
const StreamErrorDialog = ({ error }: StreamErrorProps) => {
const dispatch = useAppDispatch();
const ideMessenger = useContext(IdeMessengerContext);
@@ -25,6 +40,11 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
const selectedProfile = useAppSelector(selectSelectedProfile);
const { session, refreshProfiles } = useAuth();
+ const parsedError = useMemo(
+ () => parseErrorMessage((error as any)?.message || ""),
+ [error],
+ );
+
const handleRefreshProfiles = () => {
refreshProfiles();
dispatch(setShowDialog(false));
@@ -103,6 +123,12 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
);
+ if (
+ parsedError === "You have exceeded the chat limit for the Models Add-On."
+ ) {
+ return ;
+ }
+
let errorContent: React.ReactNode = <>>;
// Display components for specific errors
@@ -206,19 +232,22 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
}
return (
-
-
{`${statusCode ? statusCode + " " : ""}Error`}
+
+
{`Error (status code ${statusCode})`}
{message ? (
-
-
{message}
+
+
+ {parsedError}
+
{
ideMessenger.post("toggleDevTools", undefined);
}}
>
View Logs
+
) : null}
@@ -246,16 +275,6 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
Discord
-
- {
- dispatch(setDialogMessage(undefined));
- dispatch(setShowDialog(false));
- }}
- >
- Close
-
-
);