From 371adfb1d4f7c7102808ad595d7253611f12538e Mon Sep 17 00:00:00 2001
From: heimoshuiyu
Date: Wed, 22 Mar 2023 14:42:27 +0800
Subject: [PATCH] retry button
---
src/chatbox.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/chatbox.tsx b/src/chatbox.tsx
index b06b9d6..5ddc350 100644
--- a/src/chatbox.tsx
+++ b/src/chatbox.tsx
@@ -13,6 +13,7 @@ export default function ChatBOX(props: {
const [inputMsg, setInputMsg] = useState("");
const [showGenerating, setShowGenerating] = useState(false);
const [generatingMessage, setGeneratingMessage] = useState("");
+ const [showRetry, setShowRetry] = useState(false);
const client = new ChatGPT(chatStore.apiKey);
@@ -113,6 +114,7 @@ export default function ChatBOX(props: {
console.log("postBeginIndex", chatStore.postBeginIndex);
setChatStore({ ...chatStore });
} catch (error) {
+ setShowRetry(true);
alert(error);
} finally {
setShowGenerating(false);
@@ -235,6 +237,19 @@ export default function ChatBOX(props: {
...
)}
+ {showRetry && (
+
+
+
+ )}