Test apidataset (#4830)

* Dataset (#4822)

* apidataset support to basepath

* Resolve the error of the Feishu Knowledge Base modification configuration page not supporting baseurl bug.

* apibasepath

* add

* perf: api dataset

---------

Co-authored-by: dreamer6680 <1468683855@qq.com>
This commit is contained in:
Archer
2025-05-17 22:41:10 +08:00
committed by GitHub
parent c6e0b5a1e7
commit 2d2d0fffe9
11 changed files with 120 additions and 34 deletions

View File

@@ -2,7 +2,9 @@ import type {
APIFileListResponse,
ApiFileReadContentResponse,
APIFileReadResponse,
APIFileServer
ApiDatasetDetailResponse,
APIFileServer,
APIFileItem
} from '@fastgpt/global/core/dataset/apiDataset';
import axios, { type Method } from 'axios';
import { addLog } from '../../../common/system/log';
@@ -89,7 +91,7 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
`/v1/file/list`,
{
searchKey,
parentId
parentId: parentId || apiServer.basePath
},
'POST'
);
@@ -164,9 +166,34 @@ export const useApiDatasetRequest = ({ apiServer }: { apiServer: APIFileServer }
return url;
};
const getFileDetail = async ({
apiFileId
}: {
apiFileId: string;
}): Promise<ApiDatasetDetailResponse> => {
const fileData = await request<ApiDatasetDetailResponse>(
`/v1/file/detail`,
{
id: apiFileId
},
'GET'
);
if (fileData) {
return {
id: fileData.id,
name: fileData.name,
parentId: fileData.parentId === null ? '' : fileData.parentId
};
}
return Promise.reject('File not found');
};
return {
getFileContent,
listFiles,
getFilePreviewUrl
getFilePreviewUrl,
getFileDetail
};
};

View File

@@ -923,7 +923,7 @@
"not_open": "Not Open",
"not_permission": "The current subscription package does not support team operation logs",
"not_support": "Not Supported",
"not_support_wechat_image": "WeChat image rendering is not supported",
"not_support_wechat_image": "This is a WeChat picture",
"not_yet_introduced": "No Introduction Yet",
"open_folder": "Open Folder",
"option": "Option",

View File

@@ -922,7 +922,7 @@
"not_open": "未开启",
"not_permission": "当前订阅套餐不支持团队操作日志",
"not_support": "不支持",
"not_support_wechat_image": "暂时不支持微信图片渲染",
"not_support_wechat_image": "这是一张微信图片",
"not_yet_introduced": "暂无介绍",
"open_folder": "打开文件夹",
"option": "选项",

View File

@@ -922,7 +922,7 @@
"not_open": "未開啟",
"not_permission": "當前訂閱套餐不支持團隊操作日誌",
"not_support": "不支援",
"not_support_wechat_image": "暫時不支持微信圖片渲染",
"not_support_wechat_image": "這是一張微信圖片",
"not_yet_introduced": "暫無介紹",
"open_folder": "開啟資料夾",
"option": "選項",