import { PlusOutlined, SearchOutlined } from '@ant-design/icons'; import { Button, Divider, Empty, Flex, Input, Skeleton, Space, Spin, } from 'antd'; import AgentTemplateModal from './agent-template-modal'; import FlowCard from './flow-card'; import { useFetchDataOnMount, useSaveFlow } from './hooks'; import { useTranslate } from '@/hooks/common-hooks'; import { useMemo } from 'react'; import InfiniteScroll from 'react-infinite-scroll-component'; import styles from './index.less'; const FlowList = () => { const { showFlowSettingModal, hideFlowSettingModal, flowSettingVisible, flowSettingLoading, onFlowOk, } = useSaveFlow(); const { t } = useTranslate('flow'); const { data, loading, searchString, handleInputChange, fetchNextPage, hasNextPage, } = useFetchDataOnMount(); const nextList = useMemo(() => { const list = data?.pages?.flatMap((x) => (Array.isArray(x.kbs) ? x.kbs : [])) ?? []; return list; }, [data?.pages]); const total = useMemo(() => { return data?.pages.at(-1).total ?? 0; }, [data?.pages]); return ( } />
} endMessage={ !!total && {t('noMoreData')} 🤐 } scrollableTarget="scrollableDiv" scrollThreshold="200px" > {nextList.length > 0 ? ( nextList.map((item) => { return ; }) ) : ( )}
{flowSettingVisible && ( )}
); }; export default FlowList;