diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 0d139a2d6..b0cdaf484 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -5,7 +5,16 @@ import { alertContext } from "../../contexts/alertContext"; import { validateNodes } from "../../utils"; import { typesContext } from "../../contexts/typesContext"; import ChatMessage from "./chatMessage"; -import { X, MessagesSquare, Eraser, TerminalSquare, MessageCircle, MessageSquareDashed, MessageSquare, Variable } from "lucide-react"; +import { + X, + MessagesSquare, + Eraser, + TerminalSquare, + MessageCircle, + MessageSquareDashed, + MessageSquare, + Variable, +} from "lucide-react"; import { sendAllProps } from "../../types/api"; import { ChatMessageType } from "../../types/chat"; import ChatInput from "./chatInput"; @@ -74,8 +83,10 @@ export default function FormModal({ }, [open]); useEffect(() => { id.current = flow.id; - setKeysValue(Array(tabsState[flow.id].formKeysData.input_keys.length).fill("")); - }, [flow.id]); + setKeysValue( + Array(tabsState[flow.id].formKeysData.input_keys.length).fill("") + ); + }, [flow.id, tabsState[flow.id], tabsState[flow.id].formKeysData]); var isStream = false; @@ -316,7 +327,7 @@ export default function FormModal({ setLockChat(true); // Message variable makes a object with the keys being the names from tabsState[flow.id].formKeysData.input_keys and the values being the keysValue of the correspondent index let keys = tabsState[flow.id].formKeysData.input_keys; // array of keys - let values = keysValue.map((k, i) => i == chatKey ? chatValue : k); // array of values + let values = keysValue.map((k, i) => (i == chatKey ? chatValue : k)); // array of values let message = keys.reduce((object, key, index) => { object[key] = values[index]; return object; @@ -354,115 +365,126 @@ export default function FormModal({ } function handleOnCheckedChange(checked: boolean, index: number) { - if(checked === true){ + if (checked === true) { setChatKey(index); } } return ( - - - - Chat - - {CHAT_FORM_DIALOG_SUBTITLE} - + {tabsState[flow.id].formKeysData && ( + + + + Chat + + {CHAT_FORM_DIALOG_SUBTITLE} + -
-
-
- - - Input Variables - -
- - {tabsState[id.current].formKeysData.input_keys.map((i, k) => ( - - {i} - -
-
- - handleOnCheckedChange(value, k)} - size="small" - disabled={false} - /> -
- -
-
-
- ))} - {tabsState[id.current].formKeysData.memory_keys.map((i, k) => ( - -
-
{i}
- Memory Key -
-
- ))} -
-
-
-
-
- {chatHistory.length > 0 ? ( - chatHistory.map((c, i) => ( - - )) - ) : ( -
- - 👋{" "} - - LangFlow Chat - - -
-
- - Start a conversation and click the agent's thoughts{" "} - - - {" "} - to inspect the chaining process. - -
-
- )} -
+
+
+
+ + + Input Variables +
-
-
- + + {tabsState[id.current].formKeysData.input_keys.map((i, k) => ( + + {i} + +
+
+ + + handleOnCheckedChange(value, k) + } + size="small" + disabled={false} + /> +
+ +
+
+
+ ))} + {tabsState[id.current].formKeysData.memory_keys.map((i, k) => ( + +
+
{i}
+ Memory Key +
+
+ ))} +
+
+
+
+
+ {chatHistory.length > 0 ? ( + chatHistory.map((c, i) => ( + + )) + ) : ( +
+ + 👋{" "} + + LangFlow Chat + + +
+
+ + Start a conversation and click the agent's thoughts{" "} + + + {" "} + to inspect the chaining process. + +
+
+ )} +
+
+
+
+ +
-
- + + )}
); }