Merge remote-tracking branch 'origin/Wren' into PingChuan

This commit is contained in:
PingChuan
2025-12-05 23:37:37 +08:00
9 changed files with 477 additions and 65 deletions
+25 -1
View File
@@ -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;
}
+16 -2
View File
@@ -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;
}
/**