'use client'; import React, { useEffect } from "react"; import ASide from "./components/ASide"; import Flow from "./components/Flow"; import Header from "./components/Header"; import NodeRender from "./components/NodeRender"; import { trpc } from "@/lib/trpc"; import { useQuery } from '@tanstack/react-query' import { useSearchParam } from 'react-use'; import { useSession, signIn, signOut } from "next-auth/react" import { useAtom, useSetAtom, useAtomValue } from "jotai"; import { flowModelAtom, flowModelRecordAtom } from "./store"; const RunAgentFlow = () => { const multiAgentId = useSearchParam('multiAgentId') if (!multiAgentId) { // FIXME redirect to 404 } const flowModelRecordQuery = trpc.flowModel.byId.useQuery({ multiAgentId }) if (flowModelRecordQuery.isError) { // FIXME redirect to 500 } const setFlowModelRecord = useSetAtom(flowModelRecordAtom) useEffect(() => { setFlowModelRecord(flowModelRecordQuery.data) }, [flowModelRecordQuery.data]) return (
) } export default React.memo(RunAgentFlow)