fix: dataset selector load error (#4243)
* fix: dataset selector load error * fix: path auth error * fix: plugin scroll * export chat log with contact (#4211) * export chat log with contact * fix --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { DELETE, GET, POST } from '@/web/common/api/request';
|
||||
import type { CreateAppFolderBody } from '@/pages/api/core/app/folder/create';
|
||||
import type { ParentTreePathItemType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import type { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import type {
|
||||
GetPathProps,
|
||||
ParentTreePathItemType
|
||||
} from '@fastgpt/global/common/parentFolder/type';
|
||||
import type {
|
||||
transitionWorkflowBody,
|
||||
transitionWorkflowResponse
|
||||
@@ -12,10 +14,10 @@ import type { copyAppQuery, copyAppResponse } from '@/pages/api/core/app/copy';
|
||||
export const postCreateAppFolder = (data: CreateAppFolderBody) =>
|
||||
POST('/core/app/folder/create', data);
|
||||
|
||||
export const getAppFolderPath = (parentId: ParentIdType) => {
|
||||
if (!parentId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
||||
export const getAppFolderPath = (data: GetPathProps) => {
|
||||
if (!data.sourceId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
||||
|
||||
return GET<ParentTreePathItemType[]>(`/core/app/folder/path`, { parentId });
|
||||
return GET<ParentTreePathItemType[]>(`/core/app/folder/path`, data);
|
||||
};
|
||||
|
||||
/* detail */
|
||||
|
||||
@@ -12,6 +12,7 @@ import { FlowNodeTemplateTypeEnum } from '@fastgpt/global/core/workflow/constant
|
||||
import type { GetPreviewNodeQuery } from '@/pages/api/core/app/plugin/getPreviewNode';
|
||||
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
|
||||
import type {
|
||||
GetPathProps,
|
||||
ParentIdType,
|
||||
ParentTreePathItemType
|
||||
} from '@fastgpt/global/common/parentFolder/type';
|
||||
@@ -53,9 +54,9 @@ export const getPluginGroups = () => {
|
||||
: Promise.resolve([defaultGroup]);
|
||||
};
|
||||
|
||||
export const getSystemPluginPaths = (parentId: ParentIdType) => {
|
||||
if (!parentId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
||||
return GET<ParentTreePathItemType[]>('/core/app/plugin/path', { parentId });
|
||||
export const getSystemPluginPaths = (data: GetPathProps) => {
|
||||
if (!data.sourceId) return Promise.resolve<ParentTreePathItemType[]>([]);
|
||||
return GET<ParentTreePathItemType[]>('/core/app/plugin/path', data);
|
||||
};
|
||||
|
||||
export const getPreviewPluginNode = (data: GetPreviewNodeQuery) =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import type {
|
||||
GetPathProps,
|
||||
ParentIdType,
|
||||
ParentTreePathItemType
|
||||
} from '@fastgpt/global/common/parentFolder/type.d';
|
||||
@@ -77,8 +78,10 @@ export const getDatasetsByAppIdAndDatasetIds = (data: { appId: string; datasetId
|
||||
* get type=dataset list
|
||||
*/
|
||||
|
||||
export const getDatasetPaths = (parentId: ParentIdType) =>
|
||||
GET<ParentTreePathItemType[]>('/core/dataset/paths', { parentId });
|
||||
export const getDatasetPaths = (data: GetPathProps) => {
|
||||
if (!data.sourceId) return Promise.resolve([]);
|
||||
return GET<ParentTreePathItemType[]>('/core/dataset/paths', data);
|
||||
};
|
||||
|
||||
export const getDatasetById = (id: string) => GET<DatasetItemType>(`/core/dataset/detail?id=${id}`);
|
||||
|
||||
|
||||
@@ -250,7 +250,10 @@ export const DatasetPageContextProvider = ({
|
||||
|
||||
const { data: paths = [], runAsync: refetchPaths } = useRequest2(
|
||||
() =>
|
||||
getDatasetPaths(datasetDetail.parentId).then((res) => {
|
||||
getDatasetPaths({
|
||||
sourceId: datasetDetail?._id,
|
||||
type: 'parent'
|
||||
}).then((res) => {
|
||||
res.push({
|
||||
parentId: '',
|
||||
parentName: datasetDetail.name
|
||||
|
||||
Reference in New Issue
Block a user