feat: 完善Dify知识库管理召回测试模块,优化知识库上传文件时的分段配置设置
This commit is contained in:
@@ -332,7 +332,7 @@ export async function deleteChildChunk(
|
||||
*
|
||||
* @param datasetId - 知识库 ID
|
||||
* @param query - 检索关键词
|
||||
* @param retrievalModel - 检索模型配置
|
||||
* @param retrievalModel - 检索模型配置(完整的 Dify API 格式)
|
||||
* @returns 检索结果
|
||||
*/
|
||||
export async function retrieveDataset(
|
||||
@@ -340,7 +340,7 @@ export async function retrieveDataset(
|
||||
query: string,
|
||||
retrievalModel?: RetrieveRequest['retrieval_model']
|
||||
): Promise<RetrieveResponse> {
|
||||
console.log('[Dataset Client] 检索知识库:', { datasetId, query });
|
||||
console.log('[Dataset Client] 检索知识库:', { datasetId, query, retrievalModel });
|
||||
|
||||
const requestBody: RetrieveRequest = {
|
||||
query,
|
||||
|
||||
@@ -42,6 +42,7 @@ export type {
|
||||
MetadataFilterCondition,
|
||||
MetadataFilteringConditions,
|
||||
RetrieveRequest,
|
||||
RetrieveSegment,
|
||||
RetrieveRecord,
|
||||
RetrieveResponse,
|
||||
} from './segmentTypes';
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
* @module api/dify-dataset/type/segmentTypes
|
||||
*/
|
||||
|
||||
import type { RetrievalModel } from './datasetTypes';
|
||||
|
||||
// 重新导出以便其他模块使用
|
||||
export type { RetrievalModel };
|
||||
|
||||
// ============================================================================
|
||||
// 分段类型
|
||||
// ============================================================================
|
||||
@@ -154,25 +159,27 @@ export interface MetadataFilteringConditions {
|
||||
*/
|
||||
export interface RetrieveRequest {
|
||||
query: string;
|
||||
retrieval_model?: {
|
||||
search_method: 'keyword_search' | 'semantic_search' | 'full_text_search' | 'hybrid_search';
|
||||
reranking_enable?: boolean;
|
||||
reranking_model?: {
|
||||
reranking_provider_name: string;
|
||||
reranking_model_name: string;
|
||||
};
|
||||
top_k?: number;
|
||||
score_threshold_enabled?: boolean;
|
||||
score_threshold?: number;
|
||||
};
|
||||
retrieval_model?: RetrievalModel;
|
||||
metadata_filtering_conditions?: MetadataFilteringConditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检索结果中的分段信息(包含关联文档)
|
||||
*/
|
||||
export interface RetrieveSegment extends Segment {
|
||||
document?: {
|
||||
id: string;
|
||||
data_source_type: string;
|
||||
name: string;
|
||||
doc_type: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 检索结果记录
|
||||
*/
|
||||
export interface RetrieveRecord {
|
||||
segment: Segment;
|
||||
segment: RetrieveSegment;
|
||||
score: number;
|
||||
tsne_position?: {
|
||||
x: number;
|
||||
|
||||
Reference in New Issue
Block a user