ragflow/web/src/pages/add-knowledge/components/knowledge-graph/index.tsx
balibabu 6dfb0c245c
Fix: The dataset uses the new id to obtain the knowledge graph #10333 (#10339)
### What problem does this PR solve?

Fix: The dataset uses the new id to obtain the knowledge graph #10333

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-09-28 15:39:49 +08:00

31 lines
1 KiB
TypeScript

import { ConfirmDeleteDialog } from '@/components/confirm-delete-dialog';
import { Button } from '@/components/ui/button';
import { useFetchKnowledgeGraph } from '@/hooks/knowledge-hooks';
import { Trash2 } from 'lucide-react';
import React from 'react';
import { useTranslation } from 'react-i18next';
import ForceGraph from './force-graph';
import { useDeleteKnowledgeGraph } from './use-delete-graph';
const KnowledgeGraph: React.FC = () => {
const { data } = useFetchKnowledgeGraph();
const { t } = useTranslation();
const { handleDeleteKnowledgeGraph } = useDeleteKnowledgeGraph();
return (
<section className={'w-full h-full relative'}>
<ConfirmDeleteDialog onOk={handleDeleteKnowledgeGraph}>
<Button
variant="outline"
size={'sm'}
className="absolute right-0 top-0 z-50"
>
<Trash2 /> {t('common.delete')}
</Button>
</ConfirmDeleteDialog>
<ForceGraph data={data?.graph} show></ForceGraph>
</section>
);
};
export default KnowledgeGraph;