feat:新增dify接入知识库时更新文档嵌入参数的功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Segment } from '~/api/dify-dataset/type';
|
||||
import type { Segment, IndexingStatus } from '~/api/dify-dataset/type';
|
||||
import type { Document } from '~/api/dify-dataset/type/documentTypes';
|
||||
|
||||
/**
|
||||
@@ -11,20 +11,22 @@ export interface DocumentDetailProps {
|
||||
|
||||
/**
|
||||
* 分段设置配置(文档详情专用)
|
||||
* 注意:Dify API 支持的参数有限
|
||||
* 注意:update-by-file API 支持的参数
|
||||
* - separator: ✅ 支持
|
||||
* - maxTokens: ✅ 支持
|
||||
* - chunkOverlap: ✅ 支持(分段重叠长度)
|
||||
* - removeExtraSpaces: ✅ 支持
|
||||
* - removeUrlsEmails: ✅ 支持
|
||||
* - useQASegment: ⚠️ 需要 doc_form: "qa_model"
|
||||
* - indexingTechnique: ✅ 支持(high_quality/economy)
|
||||
* - doc_form/doc_language: ❌ 不支持(仅 create-by-file 支持)
|
||||
*/
|
||||
export interface DocumentDetailSegmentationSettings {
|
||||
separator: string;
|
||||
maxTokens: number;
|
||||
chunkOverlap: number;
|
||||
removeExtraSpaces: boolean;
|
||||
removeUrlsEmails: boolean;
|
||||
useQASegment: boolean;
|
||||
qaLanguage: string;
|
||||
indexingTechnique: 'high_quality' | 'economy';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,10 +35,10 @@ export interface DocumentDetailSegmentationSettings {
|
||||
export const DEFAULT_DOCUMENT_DETAIL_SETTINGS: DocumentDetailSegmentationSettings = {
|
||||
separator: '\\n\\n',
|
||||
maxTokens: 500,
|
||||
chunkOverlap: 50,
|
||||
removeExtraSpaces: true,
|
||||
removeUrlsEmails: false,
|
||||
useQASegment: false,
|
||||
qaLanguage: 'Chinese',
|
||||
indexingTechnique: 'high_quality',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -48,4 +50,20 @@ export interface DocumentDetailState {
|
||||
previewLoading: boolean;
|
||||
showPreview: boolean;
|
||||
saving: boolean;
|
||||
isProcessing: boolean;
|
||||
indexingStatus: IndexingStatus | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 索引状态配置
|
||||
*/
|
||||
export const INDEXING_STATUS_CONFIG: Record<IndexingStatus, { text: string; percent: number }> = {
|
||||
waiting: { text: '等待处理...', percent: 10 },
|
||||
parsing: { text: '解析文档...', percent: 30 },
|
||||
cleaning: { text: '清洗文本...', percent: 50 },
|
||||
splitting: { text: '分段处理...', percent: 70 },
|
||||
indexing: { text: '建立索引...', percent: 85 },
|
||||
completed: { text: '处理完成', percent: 100 },
|
||||
paused: { text: '已暂停', percent: 0 },
|
||||
error: { text: '处理失败', percent: 0 },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user