fix :Get application bound knowledge base information logical rewrite (#4057)
* fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite * fix :Get application bound knowledge base information logical rewrite
This commit is contained in:
@@ -21,7 +21,6 @@ import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { StoreEdgeItemType } from '@fastgpt/global/core/workflow/type/edge';
|
||||
import { EditorVariablePickerType } from '@fastgpt/web/components/common/Textarea/PromptEditor/type';
|
||||
import { ToolModule } from '@fastgpt/global/core/workflow/template/system/tools';
|
||||
import { useDatasetStore } from '../dataset/store/dataset';
|
||||
import {
|
||||
WorkflowStart,
|
||||
userFilesInput
|
||||
@@ -54,12 +53,7 @@ export function form2AppWorkflow(
|
||||
} {
|
||||
const datasetNodeId = 'iKBoX2vIzETU';
|
||||
const aiChatNodeId = '7BdojPlukIQw';
|
||||
|
||||
const allDatasets = useDatasetStore.getState().allDatasets;
|
||||
const selectedDatasets = data.dataset.datasets.filter((item) =>
|
||||
allDatasets.some((ds) => ds._id === item.datasetId)
|
||||
);
|
||||
|
||||
const selectedDatasets = data.dataset.datasets;
|
||||
function systemConfigTemplate(): StoreNodeItemType {
|
||||
return {
|
||||
nodeId: SystemConfigNode.id,
|
||||
|
||||
@@ -70,10 +70,11 @@ import { GetQuoteDataResponse } from '@/pages/api/core/dataset/data/getQuoteData
|
||||
export const getDatasets = (data: GetDatasetListBody) =>
|
||||
POST<DatasetListItemType[]>(`/core/dataset/list`, data);
|
||||
|
||||
export const getDatasetsByAppIdAndDatasetIds = (data: { appId: string; datasetIdList: string[] }) =>
|
||||
POST<DatasetSimpleItemType[]>(`/core/dataset/listByAppIdAndDatasetIds`, data);
|
||||
/**
|
||||
* get type=dataset list
|
||||
*/
|
||||
export const getAllDataset = () => GET<DatasetSimpleItemType[]>(`/core/dataset/allDataset`);
|
||||
|
||||
export const getDatasetPaths = (parentId: ParentIdType) =>
|
||||
GET<ParentTreePathItemType[]>('/core/dataset/paths', { parentId });
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import type {
|
||||
DatasetListItemType,
|
||||
DatasetSimpleItemType
|
||||
} from '@fastgpt/global/core/dataset/type.d';
|
||||
import { getAllDataset, getDatasets } from '@/web/core/dataset/api';
|
||||
import type { DatasetListItemType } from '@fastgpt/global/core/dataset/type.d';
|
||||
import { getDatasets } from '@/web/core/dataset/api';
|
||||
|
||||
type State = {
|
||||
allDatasets: DatasetSimpleItemType[];
|
||||
loadAllDatasets: () => Promise<DatasetSimpleItemType[]>;
|
||||
myDatasets: DatasetListItemType[];
|
||||
loadMyDatasets: (parentId?: string) => Promise<DatasetListItemType[]>;
|
||||
};
|
||||
@@ -18,14 +13,6 @@ export const useDatasetStore = create<State>()(
|
||||
devtools(
|
||||
persist(
|
||||
immer((set, get) => ({
|
||||
allDatasets: [],
|
||||
async loadAllDatasets() {
|
||||
const res = await getAllDataset();
|
||||
set((state) => {
|
||||
state.allDatasets = res;
|
||||
});
|
||||
return res;
|
||||
},
|
||||
myDatasets: [],
|
||||
async loadMyDatasets(parentId = '') {
|
||||
const res = await getDatasets({ parentId });
|
||||
|
||||
Reference in New Issue
Block a user