🐛 fix(chatComponent): remove unused openForm state variable

🐛 fix(formModal): remove console.log statement
🐛 fix(formModal): fix formatMessage function to handle string inputs correctly
This commit is contained in:
Lucas Oliveira 2023-06-28 17:13:32 -03:00
commit 9d556bc94c
2 changed files with 3 additions and 4 deletions

View file

@ -10,7 +10,6 @@ import FormModal from "../../modals/formModal";
export default function Chat({ flow }: ChatType) { export default function Chat({ flow }: ChatType) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [openForm, setOpenForm] = useState(false);
const [isBuilt, setIsBuilt] = useState(false); const [isBuilt, setIsBuilt] = useState(false);
useEffect(() => { useEffect(() => {

View file

@ -166,13 +166,13 @@ export default function FormModal({
chatItem.files chatItem.files
? { ? {
isSend: !chatItem.is_bot, isSend: !chatItem.is_bot,
message: chatItem.is_bot ? chatItem.message : formatMessage(chatItem.message), message: formatMessage(chatItem.message),
thought: chatItem.intermediate_steps, thought: chatItem.intermediate_steps,
files: chatItem.files, files: chatItem.files,
} }
: { : {
isSend: !chatItem.is_bot, isSend: !chatItem.is_bot,
message: chatItem.is_bot ? chatItem.message : formatMessage(chatItem.message), message: formatMessage(chatItem.message),
thought: chatItem.intermediate_steps, thought: chatItem.intermediate_steps,
} }
); );
@ -305,6 +305,7 @@ export default function FormModal({
}, [open]); }, [open]);
function formatMessage(inputs: any): string { function formatMessage(inputs: any): string {
if (inputs) { if (inputs) {
if(typeof inputs == "string") return inputs;
// inputs is a object with the keys and values being input_keys and keysValue // inputs is a object with the keys and values being input_keys and keysValue
// so the formated message is a string with the keys and values separated by ": " // so the formated message is a string with the keys and values separated by ": "
let message = ""; let message = "";
@ -371,7 +372,6 @@ export default function FormModal({
} }
} }
console.log(chatHistory)
return ( return (
<Dialog open={open} onOpenChange={setModalOpen}> <Dialog open={open} onOpenChange={setModalOpen}>
<DialogTrigger className="hidden"></DialogTrigger> <DialogTrigger className="hidden"></DialogTrigger>