import { get, post } from './request'; /** 附件来源类型:标识该附件归属于 RAG 知识库业务。 */ export const SOURCE_TYPE_RAG = 'RAG'; export interface RagDocument { id?: string; storeId: string; attachmentId?: string | null; documentTitle?: string | null; documentSummary?: string | null; parseStatus?: string | null; indexStatus?: string | null; enabled?: boolean | null; errorMessage?: string | null; remark?: string | null; createTime?: string | null; updateTime?: string | null; } export interface RagDocumentQueryRequest { storeId?: string; attachmentId?: string; parseStatus?: string; indexStatus?: string; enabled?: boolean; } export interface RagDocumentSaveRequest { id?: string; storeId: string; attachmentId?: string; documentTitle?: string; documentSummary?: string; parseStatus?: string; indexStatus?: string; enabled?: boolean; errorMessage?: string; remark?: string; } export interface RagDocumentBatchUploadRequest { storeId: string; sourceType?: string; files: File[]; documentSummary?: string; remark?: string; } /** * RAG 切片策略枚举值。 *
* 前后端统一传递枚举值,不再传递字符串名称。
*/
export const RAG_CHUNK_STRATEGY = {
FIXED_LENGTH: 1,
PARAGRAPH: 2,
HEADING: 3,
TABLE_ROW: 4,
DELIMITER: 5,
SEMANTIC: 6,
} as const;
export type RagChunkStrategy = (typeof RAG_CHUNK_STRATEGY)[keyof typeof RAG_CHUNK_STRATEGY];
export interface RagDocumentParseRequest {
documentIds: string[];
}
export interface RagDocumentChunkRequest {
documentIds: string[];
chunkStrategy: RagChunkStrategy;
chunkSize?: number;
chunkOverlap?: number;
delimiter?: string;
}
export interface RagDocumentParseResponse {
documentId: string;
parseStatus: string;
textLength?: number | null;
pageCount?: number | null;
sheetCount?: number | null;
metadata?: Record