feat: 知识库设置页面增加 retrieval_model 检索配置功能
1. 召回测试页面增加 Score 阈值参数配置 2. 知识库设置页面新增检索模型配置: - 检索方式 (向量/全文/混合/关键字检索) - Reranking 模型 (默认开启,不可关闭) - Top K 返回数量 - Score 阈值 (默认开启,可调节数值) 3. 修复 Dify API 字段名问题 (retrieval_model_dict) 4. 优化数据加载流程,使用详情接口获取完整配置 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import type { Dataset, DatasetsResponse } from '../type';
|
||||
import type { Dataset, DatasetsResponse, UpdateDatasetRequest } from '../type';
|
||||
|
||||
/**
|
||||
* API 基础 URL
|
||||
@@ -76,3 +76,27 @@ export async function updateDatasetName(
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新知识库设置(包含检索模型配置)
|
||||
*
|
||||
* @param datasetId - 知识库 ID
|
||||
* @param settings - 更新的设置项
|
||||
* @returns 更新后的知识库详情
|
||||
*/
|
||||
export async function updateDatasetSettings(
|
||||
datasetId: string,
|
||||
settings: UpdateDatasetRequest
|
||||
): Promise<Dataset> {
|
||||
console.log('[Dataset Client] 更新知识库设置:', { datasetId, settings });
|
||||
|
||||
const response = await axios.patch<Dataset>(
|
||||
`${API_URL}/datasets/${datasetId}`,
|
||||
settings,
|
||||
{
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
withCredentials: true,
|
||||
}
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ export interface Dataset {
|
||||
name: string;
|
||||
description: string;
|
||||
permission: 'only_me' | 'all_team_members';
|
||||
data_source_type: 'upload_file' | 'notion_import' | 'website_crawl';
|
||||
indexing_technique: 'high_quality' | 'economy';
|
||||
data_source_type: 'upload_file' | 'notion_import' | 'website_crawl' | null;
|
||||
indexing_technique: 'high_quality' | 'economy' | null;
|
||||
app_count: number;
|
||||
document_count: number;
|
||||
word_count: number;
|
||||
@@ -21,6 +21,20 @@ export interface Dataset {
|
||||
created_at: number;
|
||||
updated_by: string;
|
||||
updated_at: number;
|
||||
/** 嵌入模型提供商 */
|
||||
embedding_model_provider?: string | null;
|
||||
/** 嵌入模型名称 */
|
||||
embedding_model?: string | null;
|
||||
/** 嵌入模型是否可用 */
|
||||
embedding_available?: boolean;
|
||||
/** 检索模型配置(Dify API 返回字段名为 retrieval_model_dict) */
|
||||
retrieval_model_dict?: RetrievalModel;
|
||||
/** 标签 */
|
||||
tags?: string[];
|
||||
/** 文档形式 */
|
||||
doc_form?: string | null;
|
||||
/** 供应商 */
|
||||
provider?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user