import { AgentBackground } from '@/components/canvas/background'; import Spotlight from '@/components/spotlight'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { RAGFlowPagination } from '@/components/ui/ragflow-pagination'; import { Spin } from '@/components/ui/spin'; import { useClientPagination } from '@/hooks/logic-hooks/use-pagination'; import { useFetchVersion, useFetchVersionList, } from '@/hooks/use-agent-request'; import { IModalProps } from '@/interfaces/common'; import { cn } from '@/lib/utils'; import { formatDate } from '@/utils/date'; import { downloadJsonFile } from '@/utils/file-util'; import { ConnectionMode, ReactFlow, ReactFlowProvider } from '@xyflow/react'; import { ArrowDownToLine } from 'lucide-react'; import { ReactNode, useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { nodeTypes } from '../canvas'; export function VersionDialog({ hideModal, }: IModalProps & { initialName?: string; title?: ReactNode }) { const { t } = useTranslation(); const { data, loading } = useFetchVersionList(); const [selectedId, setSelectedId] = useState(''); const { data: agent, loading: versionLoading } = useFetchVersion(selectedId); const { page, pageSize, onPaginationChange, pagedList } = useClientPagination(data); const handleClick = useCallback( (id: string) => () => { setSelectedId(id); }, [], ); const downloadFile = useCallback(() => { const graph = agent?.dsl.graph; if (graph) { downloadJsonFile(graph, agent?.title); } }, [agent?.dsl.graph, agent?.title]); useEffect(() => { if (data.length > 0) { setSelectedId(data[0].id); } }, [data]); return ( {t('flow.historyversion')}
{loading ? ( ) : (
    {pagedList.map((x) => (
  • {x.title}
  • ))}
)}
{versionLoading ? ( ) : (
{agent?.title}

Created: {formatDate(agent?.create_date)}

({ ...x, type: 'default', })) || [] } fitView nodeTypes={nodeTypes} edgeTypes={{}} zoomOnScroll={true} panOnDrag={true} zoomOnDoubleClick={false} preventScrolling={true} minZoom={0.1} >
)}
); }