From cfb3c20afa55da0db9965478b21c4ce70dca3e09 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sun, 25 Aug 2024 03:16:56 -0400 Subject: [PATCH] Show Kodu error message if API request fails --- webview-ui/src/components/ChatRow.tsx | 43 ++++++++++++++++++++++++-- webview-ui/src/components/ChatView.tsx | 1 + 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/webview-ui/src/components/ChatRow.tsx b/webview-ui/src/components/ChatRow.tsx index f400068..2ce39d0 100644 --- a/webview-ui/src/components/ChatRow.tsx +++ b/webview-ui/src/components/ChatRow.tsx @@ -7,6 +7,7 @@ import { COMMAND_OUTPUT_STRING } from "../../../src/shared/combineCommandSequenc import { SyntaxHighlighterStyle } from "../utils/getSyntaxHighlighterStyleFromTheme" import CodeBlock from "./CodeBlock/CodeBlock" import Thumbnails from "./Thumbnails" +import { ApiProvider } from "../../../src/shared/api" interface ChatRowProps { message: ClaudeMessage @@ -15,6 +16,7 @@ interface ChatRowProps { onToggleExpand: () => void lastModifiedMessage?: ClaudeMessage isLast: boolean + apiProvider?: ApiProvider } const ChatRow: React.FC = ({ @@ -24,6 +26,7 @@ const ChatRow: React.FC = ({ onToggleExpand, lastModifiedMessage, isLast, + apiProvider, }) => { const cost = message.text != null && message.say === "api_req_started" ? JSON.parse(message.text).cost : undefined const apiRequestFailedMessage = @@ -274,9 +277,43 @@ const ChatRow: React.FC = ({ {cost == null && apiRequestFailedMessage && ( -

- {apiRequestFailedMessage} -

+ <> +

+ {apiRequestFailedMessage} +

+ {apiProvider === "kodu" && ( +
+ + + Uh-oh, this could be a problem on Kodu's end. We've been alerted and + will resolve this ASAP. You can also{" "} + + contact us on discord + + . + +
+ )} + )} ) diff --git a/webview-ui/src/components/ChatView.tsx b/webview-ui/src/components/ChatView.tsx index 8121167..697198e 100644 --- a/webview-ui/src/components/ChatView.tsx +++ b/webview-ui/src/components/ChatView.tsx @@ -538,6 +538,7 @@ const ChatView = ({ onToggleExpand={() => toggleRowExpansion(message.ts)} lastModifiedMessage={modifiedMessages.at(-1)} isLast={index === visibleMessages.length - 1} + apiProvider={apiConfiguration?.apiProvider} /> )} />