fix:清除一些关于通过api接入dify不支持修改的功能
This commit is contained in:
@@ -594,7 +594,7 @@ export default function AreaDatasetConfig() {
|
||||
</Form.Item>
|
||||
|
||||
{/* 知识库描述 */}
|
||||
<Form.Item
|
||||
{/* <Form.Item
|
||||
name="dataset_description"
|
||||
label="知识库描述"
|
||||
>
|
||||
@@ -603,7 +603,7 @@ export default function AreaDatasetConfig() {
|
||||
rows={3}
|
||||
maxLength={500}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Form.Item> */}
|
||||
|
||||
{/* 高级设置折叠面板 */}
|
||||
<div style={{ marginTop: '24px' }}>
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { Form, Input, Button, Card, Spin, Divider, Select, Slider, InputNumber, Tooltip, Checkbox } from 'antd';
|
||||
import { SaveOutlined, QuestionCircleOutlined, CheckCircleFilled } from '@ant-design/icons';
|
||||
import { CheckCircleFilled, QuestionCircleOutlined, SaveOutlined } from '@ant-design/icons';
|
||||
import { Button, Card, Checkbox, Descriptions, Divider, InputNumber, Select, Slider, Spin, Tag, Tooltip } from 'antd';
|
||||
import { useDatasetSettings, type SearchMethod } from '~/hooks/dify-dataset-manager/dataset-settings';
|
||||
import type { DatasetSettingsProps } from '~/types/dify-dataset-manager/dataset-settings';
|
||||
|
||||
const { TextArea } = Input;
|
||||
|
||||
// 检索方式选项
|
||||
const SEARCH_METHOD_OPTIONS: { label: string; value: SearchMethod; description: string }[] = [
|
||||
{ label: '向量检索', value: 'semantic_search', description: '基于语义理解的智能检索,适合需要理解上下文的场景' },
|
||||
@@ -15,23 +13,21 @@ const SEARCH_METHOD_OPTIONS: { label: string; value: SearchMethod; description:
|
||||
|
||||
/**
|
||||
* 知识库设置组件
|
||||
* 用于修改知识库名称和描述
|
||||
* 使用 Descriptions 展示只读的知识库基本信息,提供可编辑的检索设置
|
||||
* 注:Dify API 不支持修改知识库名称和描述,故这些字段仅作只读展示
|
||||
*/
|
||||
export default function DatasetSettings({
|
||||
dataset,
|
||||
onDatasetUpdated,
|
||||
}: DatasetSettingsProps) {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const {
|
||||
saving,
|
||||
hasChanges,
|
||||
retrievalSettings,
|
||||
handleValuesChange,
|
||||
handleSave,
|
||||
handleReset,
|
||||
updateRetrievalSettings,
|
||||
} = useDatasetSettings(dataset, form, onDatasetUpdated);
|
||||
} = useDatasetSettings(dataset, onDatasetUpdated);
|
||||
|
||||
// 是否需要显示 Reranking 提示(语义检索和混合检索需要,且强制开启)
|
||||
const showRerankingInfo = retrievalSettings.searchMethod === 'semantic_search' || retrievalSettings.searchMethod === 'hybrid_search';
|
||||
@@ -53,66 +49,56 @@ export default function DatasetSettings({
|
||||
<div className="page-header">
|
||||
<h1>设置</h1>
|
||||
<p className="page-description">
|
||||
管理知识库的基本信息
|
||||
管理知识库的基本信息和检索配置
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 设置表单 */}
|
||||
<Card className="settings-card">
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onValuesChange={handleValuesChange}
|
||||
{/* 知识库基本信息 */}
|
||||
<Card
|
||||
className="settings-card"
|
||||
title={
|
||||
<span style={{ fontSize: 16, fontWeight: 500 }}>
|
||||
知识库信息
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<Descriptions
|
||||
column={{ xs: 1, sm: 2, md: 2, lg: 3 }}
|
||||
labelStyle={{
|
||||
color: '#8c8c8c',
|
||||
fontWeight: 400,
|
||||
}}
|
||||
contentStyle={{
|
||||
color: '#262626',
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
<Form.Item
|
||||
name="name"
|
||||
label="知识库名称"
|
||||
rules={[
|
||||
{ required: true, message: '请输入知识库名称' },
|
||||
{ max: 100, message: '名称不能超过100个字符' },
|
||||
]}
|
||||
>
|
||||
<Input placeholder="请输入知识库名称" maxLength={100} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="description"
|
||||
label="知识库描述"
|
||||
extra="描述知识库的用途和内容(仅展示,暂不支持修改)"
|
||||
>
|
||||
<TextArea
|
||||
placeholder="请输入知识库描述"
|
||||
rows={4}
|
||||
maxLength={500}
|
||||
showCount
|
||||
disabled
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
{/* 只读信息 */}
|
||||
<div className="readonly-info">
|
||||
<div className="info-item">
|
||||
<span className="info-label">索引方式:</span>
|
||||
<span className="info-value">
|
||||
{dataset.indexing_technique === 'high_quality' ? '高质量' : '经济'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="info-item">
|
||||
<span className="info-label">文档数量:</span>
|
||||
<span className="info-value">{dataset.document_count}</span>
|
||||
</div>
|
||||
<div className="info-item">
|
||||
<span className="info-label">总字符数:</span>
|
||||
<span className="info-value">{dataset.word_count?.toLocaleString()}</span>
|
||||
</div>
|
||||
<div className="info-item">
|
||||
<span className="info-label">创建时间:</span>
|
||||
<span className="info-value">
|
||||
{new Date(dataset.created_at * 1000).toLocaleString('zh-CN')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
<Descriptions.Item label="知识库名称" span={3}>
|
||||
<span style={{ fontSize: 15 }}>{dataset.name}</span>
|
||||
</Descriptions.Item>
|
||||
{dataset.description && (
|
||||
<Descriptions.Item label="描述" span={3}>
|
||||
<span style={{ color: '#595959' }}>{dataset.description}</span>
|
||||
</Descriptions.Item>
|
||||
)}
|
||||
<Descriptions.Item label="索引方式">
|
||||
<Tag color={dataset.indexing_technique === 'high_quality' ? 'green' : 'blue'}>
|
||||
{dataset.indexing_technique === 'high_quality' ? '高质量' : '经济'}
|
||||
</Tag>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="文档数量">
|
||||
<span style={{ fontFamily: 'monospace' }}>{dataset.document_count}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="总字符数">
|
||||
<span style={{ fontFamily: 'monospace' }}>{dataset.word_count?.toLocaleString() || 0}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="创建时间" span={2}>
|
||||
{new Date(dataset.created_at * 1000).toLocaleString('zh-CN')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="最后更新">
|
||||
{new Date(dataset.updated_at * 1000).toLocaleString('zh-CN')}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
</Card>
|
||||
|
||||
{/* 检索设置卡片 */}
|
||||
|
||||
Reference in New Issue
Block a user