From 91c1058d4c175586d22f9c7822663961fe3d62ae Mon Sep 17 00:00:00 2001 From: tylerslaton Date: Mon, 1 Jul 2024 15:43:09 -0400 Subject: [PATCH] fix: bubble errors up from GPTScript correctly Signed-off-by: tylerslaton --- components/script.tsx | 4 +- components/script/chatBar.tsx | 7 ++- components/script/chatBar/upload.tsx | 4 +- components/script/messages.tsx | 33 ++++++++------ components/script/useChatSocket.tsx | 23 +++++++++- package.json | 1 + server.mjs | 66 ++++++++++++++-------------- 7 files changed, 85 insertions(+), 53 deletions(-) diff --git a/components/script.tsx b/components/script.tsx index 0c0c8f6f..ca45122a 100644 --- a/components/script.tsx +++ b/components/script.tsx @@ -28,7 +28,7 @@ const Script: React.FC = ({ file, className, messagesHeight = 'h-fu const [hasParams, setHasParams] = useState(false); const [isEmpty, setIsEmpty] = useState(false); const { - socket, connected, running, messages, setMessages, restart, interrupt, generating + socket, connected, running, messages, setMessages, restart, interrupt, generating, error } = useChatSocket(isEmpty); useEffect(() => { @@ -117,7 +117,7 @@ const Script: React.FC = ({ file, className, messagesHeight = 'h-fu handleInputChange={handleInputChange} /> ) : ( - + )} diff --git a/components/script/chatBar.tsx b/components/script/chatBar.tsx index bd83d9c2..f9590061 100644 --- a/components/script/chatBar.tsx +++ b/components/script/chatBar.tsx @@ -13,6 +13,7 @@ import { GoIssueReopened, GoSquare, GoSquareFill } from "react-icons/go"; const ChatBar = ({ generating, + disabled = false, onBack, noChat, onInterrupt, @@ -21,6 +22,7 @@ const ChatBar = ({ onRestart, }: { generating: boolean; + disabled?: boolean; onBack: () => void; onInterrupt: () => void; onMessageSent: (message: string) => void; @@ -67,8 +69,9 @@ const ChatBar = ({ onPress={onRestart} /> - +