From 08dacd70424bdfc3299a98a24eb4c45f64271aba Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 9 May 2023 20:07:48 -0300 Subject: [PATCH] handle files on end --- src/frontend/src/modals/chatModal/index.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/modals/chatModal/index.tsx b/src/frontend/src/modals/chatModal/index.tsx index 8070569e2..3d24b1cc0 100644 --- a/src/frontend/src/modals/chatModal/index.tsx +++ b/src/frontend/src/modals/chatModal/index.tsx @@ -60,11 +60,14 @@ export default function ChatModal({ str, thought, end = false, + files + }: { str?: string; thought?: string; // end param default is false end?: boolean; + files?: Array }) { setChatHistory((old) => { let newChat = [...old]; @@ -79,6 +82,9 @@ export default function ChatModal({ if (thought) { newChat[newChat.length - 1].thought = thought; } + if(files){ + newChat[newChat.length - 1].files = files; + } return newChat; }); } @@ -133,18 +139,23 @@ export default function ChatModal({ } if (data.type === "end") { if (data.intermediate_steps) { + updateLastMessage({ str: data.message, thought: data.intermediate_steps, end: true, }); } + if(data.files){ + updateLastMessage({ + end: true, + files: data.files + }); + } + setLockChat(false); isStream = false; } - if (data.type === "file") { - console.log(data); - } if (data.type === "stream" && isStream) { updateLastMessage({ str: data.message }); }