From ab71831ca9eb21acd6bbf1d9c7b4f00031eb0d7d Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 18 Jun 2024 19:12:07 -0300 Subject: [PATCH] update no output message --- .../components/chatView/chatMessage/index.tsx | 72 +++++++++---------- .../IOModal/components/chatView/index.tsx | 5 +- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx index 067aca4c4..2782b70f9 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/chatMessage/index.tsx @@ -188,7 +188,7 @@ export default function ChatMessage({ {props.children}; @@ -235,7 +235,7 @@ export default function ChatMessage({ }, ]} activeTab={"0"} - setActiveTab={() => {}} + setActiveTab={() => { }} /> ) : ( @@ -245,7 +245,7 @@ export default function ChatMessage({ }, }} > - {chatMessage} + {chatMessage===""?EMPTY_INPUT_SEND_MESSAGE:chatMessage} ), [chat.message, chatMessage], @@ -274,52 +274,52 @@ export default function ChatMessage({ } /> - + {promptOpen ? template?.split("\n")?.map((line, index) => { - const regex = /{([^}]+)}/g; - let match; - let parts: Array = []; - let lastIndex = 0; - while ((match = regex.exec(line)) !== null) { - // Push text up to the match - if (match.index !== lastIndex) { - parts.push(line.substring(lastIndex, match.index)); - } - // Push div with matched text - if (chat.message[match[1]]) { - parts.push( - - {chat.message[match[1]]} - , - ); - } + const regex = /{([^}]+)}/g; + let match; + let parts: Array = []; + let lastIndex = 0; + while ((match = regex.exec(line)) !== null) { + // Push text up to the match + if (match.index !== lastIndex) { + parts.push(line.substring(lastIndex, match.index)); + } + // Push div with matched text + if (chat.message[match[1]]) { + parts.push( + + {chat.message[match[1]]} + , + ); + } - // Update last index - lastIndex = regex.lastIndex; - } - // Push text after the last match - if (lastIndex !== line.length) { - parts.push(line.substring(lastIndex)); - } - return

{parts}

; - }) - : chatMessage} + // Update last index + lastIndex = regex.lastIndex; + } + // Push text after the last match + if (lastIndex !== line.length) { + parts.push(line.substring(lastIndex)); + } + return

{parts}

; + }) + : (chatMessage === "" ? EMPTY_INPUT_SEND_MESSAGE : chatMessage) + }
) : (
- {chatMessage} + {(chatMessage === "" ? EMPTY_INPUT_SEND_MESSAGE : chatMessage)} {chat.files && (
diff --git a/src/frontend/src/modals/IOModal/components/chatView/index.tsx b/src/frontend/src/modals/IOModal/components/chatView/index.tsx index 0a0fbd62f..1149425dc 100644 --- a/src/frontend/src/modals/IOModal/components/chatView/index.tsx +++ b/src/frontend/src/modals/IOModal/components/chatView/index.tsx @@ -80,10 +80,7 @@ export default function ChatView({ return { isSend: !is_ai, - message: - (message === "" || !message) && !stream_url && files?.length === 0 - ? EMPTY_INPUT_SEND_MESSAGE - : message, + message, sender_name, componentId: output.id, stream_url: stream_url,