diff --git a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx index 215b75971..b35228008 100644 --- a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx @@ -10,6 +10,7 @@ import { alertContext } from "../../../contexts/alertContext"; import { postBuildInit } from "../../../controllers/API"; import RadialProgressComponent from "../../RadialProgress"; +import { TabsContext } from "../../../contexts/tabsContext"; export default function BuildTrigger({ open, @@ -24,6 +25,7 @@ export default function BuildTrigger({ }) { const { updateSSEData, isBuilding, setIsBuilding, sseData } = useSSE(); const { reactFlowInstance } = useContext(typesContext); + const { setTabsState } = useContext(TabsContext); const { setErrorData, setSuccessData } = useContext(alertContext); const [isIconTouched, setIsIconTouched] = useState(false); const eventClick = isBuilding ? "pointer-events-none" : ""; @@ -87,6 +89,17 @@ export default function BuildTrigger({ } else if (parsedData.log) { // If the event is a log, log it setSuccessData({ title: parsedData.log }); + } else if (parsedData.input_keys) { + setTabsState((old) => { + return { + ...old, + [flowId]: { + ...old[flowId], + formKeysData: parsedData, + + } + }; + }) } else { // Otherwise, process the data const isValid = processStreamResult(parsedData); diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 451955a14..741cf4ec8 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -72,7 +72,7 @@ export default function Chat({ flow }: ChatType) { isBuilt={isBuilt} /> - + diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 7637699e3..0987d27db 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -597,6 +597,7 @@ export function TabsProvider({ children }: { children: ReactNode }) { return { ...prev, [tabId]: { + ...prev[tabId], isPending: false, }, }; diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 7fcb32cc8..3023cfa49 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -18,6 +18,7 @@ import { postValidateCode } from "../../controllers/API"; import { Button } from "../../components/ui/button"; import { Input } from "../../components/ui/input"; import { Label } from "../../components/ui/label"; +import { TabsContext } from "../../contexts/tabsContext"; export default function FormModal({ flow, @@ -32,6 +33,7 @@ export default function FormModal({ const [chatHistory, setChatHistory] = useState([]); const { reactFlowInstance } = useContext(typesContext); const { setErrorData, setNoticeData } = useContext(alertContext); + const { tabsState } = useContext(TabsContext); const ws = useRef(null); const [lockChat, setLockChat] = useState(false); const isOpen = useRef(open); @@ -49,6 +51,7 @@ export default function FormModal({ }, [open]); useEffect(() => { id.current = flow.id; + console.log(tabsState[flow.id]) }, [flow.id]); var isStream = false; diff --git a/src/frontend/src/types/tabs/index.ts b/src/frontend/src/types/tabs/index.ts index 55829d6ca..6b4e2be4f 100644 --- a/src/frontend/src/types/tabs/index.ts +++ b/src/frontend/src/types/tabs/index.ts @@ -33,5 +33,6 @@ export type TabsContextType = { export type TabsState = { [key: string]: { isPending: boolean; + formKeysData: {input_keys?: Array, memory_keys?: Array}; }; };