From 9a5f2e24d50fa070b69ba70a9b8802ea36281ebb Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 6 Mar 2023 21:52:16 -0300 Subject: [PATCH] first version of thought ready --- .../src/components/chatComponent/index.tsx | 27 +++++++++++++++---- langflow/frontend/src/types/flow/index.ts | 2 +- langflow/frontend/src/utils.ts | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/langflow/frontend/src/components/chatComponent/index.tsx b/langflow/frontend/src/components/chatComponent/index.tsx index 613c5afad..2bda7ea95 100644 --- a/langflow/frontend/src/components/chatComponent/index.tsx +++ b/langflow/frontend/src/components/chatComponent/index.tsx @@ -22,10 +22,18 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { const [chatValue, setChatValue] = useState(""); const [chatHistory, setChatHistory] = useState(flow.chat); const { setErrorData } = useContext(alertContext); - const addChatHistory = (message: string, isSend: boolean) => { + const addChatHistory = ( + message: string, + isSend: boolean, + thinking?: string + ) => { setChatHistory((old) => { let newChat = _.cloneDeep(old); - newChat.push({ message, isSend }); + if (thinking) { + newChat.push({ message, isSend, thinking }); + } else { + newChat.push({ message, isSend }); + } return newChat; }); setSaveChat((chat) => !chat); @@ -138,6 +146,15 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { style={{ backgroundColor: nodeColors["chat"] }} className="text-start inline-block text-white rounded-xl p-3 overflow-hidden w-fit max-w-[280px] px-5 text-sm font-normal rounded-tl-none" > + {(c.thinking && c.thinking!=="") && ( +
+ teste +
+ )} + {(c.thinking && c.thinking!=="") &&

} {c.message} @@ -167,16 +184,16 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) { setChatValue(e.target.value); }} className={classNames( - lockChat ? "bg-gray-500" : "dark:bg-gray-700", + lockChat ? "bg-gray-500 text-white" : "dark:bg-gray-700", "form-input block w-full rounded-md border-gray-300 dark:border-gray-600 dark:text-white pr-10 sm:text-sm" )} - placeholder="Send a message..." + placeholder={lockChat?"please wait for the response":"Send a message..."} />