feat:替换 Dify 为自建 RAG去实现
1、修复了若干无权限时的失败提示语 2、新增了一个生成后续建议问题的功能 3、重构了知识问答部分的权限管理模块 4、修复了若干渲染不恰当的样式渲染
This commit is contained in:
@@ -22,6 +22,7 @@ import type { ColumnsType } from 'antd/es/table';
|
||||
import type { Document, IndexingStatus } from '~/api/dify-dataset/type/documentTypes';
|
||||
import { useDocumentList } from '~/hooks/dify-dataset-manager/document-list';
|
||||
import type { DocumentListProps } from '~/types/dify-dataset-manager/document-list';
|
||||
import { usePermission } from '~/hooks/usePermission';
|
||||
import '../../styles/components/dify-dataset-manager/index.css';
|
||||
import DocumentUpload from './document-upload';
|
||||
|
||||
@@ -40,6 +41,7 @@ export default function DocumentList({
|
||||
onDocumentStatusChanged,
|
||||
onRefresh,
|
||||
onViewDocument,
|
||||
canEditDataset = true,
|
||||
}: DocumentListProps) {
|
||||
const {
|
||||
searchValue,
|
||||
@@ -57,6 +59,9 @@ export default function DocumentList({
|
||||
filterDocuments,
|
||||
} = useDocumentList(datasetId, onDocumentDeleted, onDocumentStatusChanged, onRefresh);
|
||||
|
||||
const { hasPermission } = usePermission();
|
||||
const canWrite = hasPermission('dify:document:manage') && canEditDataset;
|
||||
|
||||
// 过滤文档
|
||||
const filteredDocuments = filterDocuments(documents);
|
||||
|
||||
@@ -111,6 +116,7 @@ export default function DocumentList({
|
||||
<Switch
|
||||
size="small"
|
||||
checked={enabled}
|
||||
disabled={!canWrite}
|
||||
onChange={(checked) => handleToggleStatus(record.id, checked)}
|
||||
/>
|
||||
),
|
||||
@@ -136,24 +142,26 @@ export default function DocumentList({
|
||||
onClick={() => onViewDocument?.(record)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Popconfirm
|
||||
title="确定要删除这个文档吗?"
|
||||
description="删除后无法恢复"
|
||||
onConfirm={() => handleDelete(record.id)}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
>
|
||||
<Tooltip title="删除">
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
loading={deletingId === record.id}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
{canWrite && (
|
||||
<Popconfirm
|
||||
title="确定要删除这个文档吗?"
|
||||
description="删除后无法恢复"
|
||||
onConfirm={() => handleDelete(record.id)}
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
okButtonProps={{ danger: true }}
|
||||
>
|
||||
<Tooltip title="删除">
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
loading={deletingId === record.id}
|
||||
/>
|
||||
</Tooltip>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
@@ -183,14 +191,16 @@ export default function DocumentList({
|
||||
loading={loading}
|
||||
/>
|
||||
</Tooltip>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<CloudUploadOutlined />}
|
||||
onClick={handleUploadClick}
|
||||
disabled={!datasetId}
|
||||
>
|
||||
添加文件
|
||||
</Button>
|
||||
{canWrite && (
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<CloudUploadOutlined />}
|
||||
onClick={handleUploadClick}
|
||||
disabled={!datasetId}
|
||||
>
|
||||
添加文件
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user