diff --git a/app/src/client/app/PlayGroundPage.tsx b/app/src/client/app/PlayGroundPage.tsx index f8f1b21d..c5dcbe7d 100644 --- a/app/src/client/app/PlayGroundPage.tsx +++ b/app/src/client/app/PlayGroundPage.tsx @@ -82,8 +82,19 @@ const PlayGroundPage = ({ user }: { user: User }) => { useEffect(() => { if (formSubmitMsg && currentChatDetails) { if (!currentChatDetails.userRespondedWithNextAction) { - const decodedMessage = decodeURIComponent(formSubmitMsg); - setTriggerChatFormSubmitMsg(decodedMessage); + try { + const decodedMessage = decodeURIComponent(formSubmitMsg); + setTriggerChatFormSubmitMsg(decodedMessage); + } catch (err: any) { + console.log('Error: ' + err.message); + setNotificationErrorMessage('There was an error processing your message. Please start a new chat.'); + updateCurrentChat({ + id: activeChatId, + data: { + isChatTerminated: true, + }, + }); + } } removeQueryParameters(); } @@ -198,9 +209,11 @@ const PlayGroundPage = ({ user }: { user: User }) => { /> ) : ( -
- -
+ !currentChatDetails.isChatTerminated && ( +
+ +
+ ) )} ) : ( diff --git a/app/src/client/components/NotificationBox.tsx b/app/src/client/components/NotificationBox.tsx index 55f83d4e..412b6a4c 100644 --- a/app/src/client/components/NotificationBox.tsx +++ b/app/src/client/components/NotificationBox.tsx @@ -14,7 +14,7 @@ const NotificationBox: React.FC = ({ type, message, onClic const isSuccess = type === 'success'; return ( -
+

{isSuccess ? 'Success' : 'Error'}

{message}