MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / Agentflows

Function Agentflows

packages/ui/src/views/agentflows/index.jsx:36–398  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34// ==============================|| AGENTS ||============================== //
35
36const Agentflows = () => {
37 const navigate = useNavigate()
38 const theme = useTheme()
39 const customization = useSelector((state) => state.customization)
40
41 const [isLoading, setLoading] = useState(true)
42 const [images, setImages] = useState({})
43 const [icons, setIcons] = useState({})
44 const [scheduleStatuses, setScheduleStatuses] = useState({})
45 const [search, setSearch] = useState('')
46 const { error, setError } = useError()
47
48 const getAllAgentflows = useApi(chatflowsApi.getAllAgentflows)
49 const [view, setView] = useState(localStorage.getItem('agentFlowDisplayStyle') || 'card')
50 const [agentflowVersion, setAgentflowVersion] = useState(localStorage.getItem('agentFlowVersion') || 'v2')
51 const [showDeprecationNotice, setShowDeprecationNotice] = useState(true)
52
53 /* Table Pagination */
54 const [currentPage, setCurrentPage] = useState(1)
55 const [pageLimit, setPageLimit] = useState(() => Number(localStorage.getItem('agentFlowPageSize') || DEFAULT_ITEMS_PER_PAGE))
56 const [total, setTotal] = useState(0)
57
58 const onChange = (page, pageLimit) => {
59 setCurrentPage(page)
60 setPageLimit(pageLimit)
61 localStorage.setItem('agentFlowPageSize', pageLimit)
62 refresh(page, pageLimit, agentflowVersion)
63 }
64
65 const refresh = (page, limit, nextView) => {
66 const params = {
67 page: page || currentPage,
68 limit: limit || pageLimit
69 }
70 getAllAgentflows.request(nextView === 'v2' ? 'AGENTFLOW' : 'MULTIAGENT', params)
71 }
72
73 const handleChange = (event, nextView) => {
74 if (nextView === null) return
75 localStorage.setItem('agentFlowDisplayStyle', nextView)
76 setView(nextView)
77 }
78
79 const handleVersionChange = (event, nextView) => {
80 if (nextView === null) return
81 localStorage.setItem('agentFlowVersion', nextView)
82 setAgentflowVersion(nextView)
83 refresh(1, pageLimit, nextView)
84 }
85
86 const onSearchChange = (event) => {
87 setSearch(event.target.value)
88 }
89
90 function filterFlows(data) {
91 return (
92 data.name.toLowerCase().indexOf(search.toLowerCase()) > -1 ||
93 (data.category && data.category.toLowerCase().indexOf(search.toLowerCase()) > -1) ||

Callers

nothing calls this directly

Calls 5

useErrorFunction · 0.90
refreshFunction · 0.70
goToCanvasFunction · 0.70
parseMethod · 0.65
catchMethod · 0.45

Tested by

no test coverage detected