mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
New dpcs structure and dataset i18n (#551)
* perf: check balance * md * lock way * i18n * docs * doc * i18n * update doc * feat: one link sync * feat: one link sync * feat: one link sync * feat: one link sync * feat: one link sync * feat: one link sync * feat: one link sync
This commit is contained in:
@@ -57,7 +57,7 @@ export const useConfirm = (props?: {
|
||||
[onOpen]
|
||||
),
|
||||
ConfirmModal: useCallback(
|
||||
() => (
|
||||
({ isLoading }: { isLoading?: boolean }) => (
|
||||
<MyModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
@@ -82,6 +82,7 @@ export const useConfirm = (props?: {
|
||||
<Button
|
||||
{...(bg && { bg: `${bg} !important` })}
|
||||
ml={4}
|
||||
isLoading={isLoading}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
typeof confirmCb.current === 'function' && confirmCb.current();
|
||||
|
7
projects/app/src/web/common/system/doc.ts
Normal file
7
projects/app/src/web/common/system/doc.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { feConfigs } from './staticData';
|
||||
|
||||
export const getDocPath = (path: string) => {
|
||||
if (!feConfigs?.docUrl) return '';
|
||||
if (feConfigs.docUrl.endsWith('/')) return feConfigs.docUrl;
|
||||
return feConfigs.docUrl + path;
|
||||
};
|
@@ -46,6 +46,11 @@ export const putDatasetById = (data: DatasetUpdateBody) => PUT<void>(`/core/data
|
||||
|
||||
export const delDatasetById = (id: string) => DELETE(`/core/dataset/delete?id=${id}`);
|
||||
|
||||
export const postWebsiteSync = (data: PostWebsiteSyncParams) =>
|
||||
POST(`/plusApi/core/dataset/websiteSync`, data, {
|
||||
timeout: 600000
|
||||
}).catch();
|
||||
|
||||
export const getCheckExportLimit = (datasetId: string) =>
|
||||
GET(`/core/dataset/checkExportLimit`, { datasetId });
|
||||
|
||||
@@ -66,10 +71,8 @@ export const putDatasetCollectionById = (data: UpdateDatasetCollectionParams) =>
|
||||
POST(`/core/dataset/collection/update`, data);
|
||||
export const delDatasetCollectionById = (params: { collectionId: string }) =>
|
||||
DELETE(`/core/dataset/collection/delete`, params);
|
||||
export const postWebsiteSync = (data: PostWebsiteSyncParams) =>
|
||||
POST(`/plusApi/core/dataset/websiteSync`, data, {
|
||||
timeout: 600000
|
||||
}).catch();
|
||||
export const postLinkCollectionSync = (collectionId: string) =>
|
||||
POST(`/core/dataset/collection/sync/link`, { collectionId });
|
||||
|
||||
/* =============================== data ==================================== */
|
||||
/* get dataset list */
|
||||
|
@@ -2,9 +2,17 @@ import { create } from 'zustand';
|
||||
import { devtools, persist } from 'zustand/middleware';
|
||||
import { immer } from 'zustand/middleware/immer';
|
||||
import type { DatasetItemType, DatasetListItemType } from '@fastgpt/global/core/dataset/type.d';
|
||||
import { getAllDataset, getDatasets, getDatasetById, putDatasetById } from '@/web/core/dataset/api';
|
||||
import {
|
||||
getAllDataset,
|
||||
getDatasets,
|
||||
getDatasetById,
|
||||
putDatasetById,
|
||||
postWebsiteSync
|
||||
} from '@/web/core/dataset/api';
|
||||
import { defaultDatasetDetail } from '@/constants/dataset';
|
||||
import type { DatasetUpdateBody } from '@fastgpt/global/core/dataset/api.d';
|
||||
import { DatasetStatusEnum } from '@fastgpt/global/core/dataset/constant';
|
||||
import { postCreateTrainingBill } from '@/web/support/wallet/bill/api';
|
||||
|
||||
type State = {
|
||||
allDatasets: DatasetListItemType[];
|
||||
@@ -15,6 +23,7 @@ type State = {
|
||||
datasetDetail: DatasetItemType;
|
||||
loadDatasetDetail: (id: string, init?: boolean) => Promise<DatasetItemType>;
|
||||
updateDataset: (data: DatasetUpdateBody) => Promise<any>;
|
||||
startWebsiteSync: () => Promise<any>;
|
||||
};
|
||||
|
||||
export const useDatasetStore = create<State>()(
|
||||
@@ -76,6 +85,22 @@ export const useDatasetStore = create<State>()(
|
||||
: item
|
||||
);
|
||||
});
|
||||
},
|
||||
async startWebsiteSync() {
|
||||
const [_, billId] = await Promise.all([
|
||||
get().updateDataset({
|
||||
id: get().datasetDetail._id,
|
||||
status: DatasetStatusEnum.syncing
|
||||
}),
|
||||
postCreateTrainingBill({
|
||||
name: 'core.dataset.training.Website Sync',
|
||||
vectorModel: get().datasetDetail.vectorModel.model,
|
||||
agentModel: get().datasetDetail.agentModel.model
|
||||
})
|
||||
]);
|
||||
try {
|
||||
postWebsiteSync({ datasetId: get().datasetDetail._id, billId });
|
||||
} catch (error) {}
|
||||
}
|
||||
})),
|
||||
{
|
||||
|
Reference in New Issue
Block a user