Files
ragflow/web/src/pages/datasets/dataset-card.tsx
chanx e6cb74b27f Fix (next search): Optimize the search problem interface and related functions #3221 (#9569)
### What problem does this PR solve?

Fix (next search): Optimize the search problem interface and related
functions #3221

-Add search_id to the retrievval_test interface
-Optimize handleSearchStrChange and handleSearch callbacks to determine
whether to enable AI search based on search configuration

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-08-19 19:22:07 +08:00

53 lines
1.6 KiB
TypeScript

import { HomeCard } from '@/components/home-card';
import { MoreButton } from '@/components/more-button';
import { Card, CardContent } from '@/components/ui/card';
import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
import { IKnowledge } from '@/interfaces/database/knowledge';
import { ChevronRight } from 'lucide-react';
import { DatasetDropdown } from './dataset-dropdown';
import { useDisplayOwnerName } from './use-display-owner';
import { useRenameDataset } from './use-rename-dataset';
export type DatasetCardProps = {
dataset: IKnowledge;
} & Pick<ReturnType<typeof useRenameDataset>, 'showDatasetRenameModal'>;
export function DatasetCard({
dataset,
showDatasetRenameModal,
}: DatasetCardProps) {
const { navigateToDataset } = useNavigatePage();
const displayOwnerName = useDisplayOwnerName();
const owner = displayOwnerName(dataset.tenant_id, dataset.nickname);
return (
<HomeCard
data={{ ...dataset, description: `${dataset.doc_num} files` }}
moreDropdown={
<DatasetDropdown
showDatasetRenameModal={showDatasetRenameModal}
dataset={dataset}
>
<MoreButton></MoreButton>
</DatasetDropdown>
}
onClick={() => {
navigateToDataset(dataset.id);
}}
/>
);
}
export function SeeAllCard() {
const { navigateToDatasetList } = useNavigatePage();
return (
<Card className="w-40" onClick={navigateToDatasetList}>
<CardContent className="p-2.5 pt-1 w-full h-full flex items-center justify-center gap-1.5 text-text-secondary">
See All <ChevronRight className="size-4" />
</CardContent>
</Card>
);
}