mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
feat: system config type;fix: retraining permission (#4772)
* feat: system config type * fix: retraining permission
This commit is contained in:
@@ -140,25 +140,27 @@ const DataCard = () => {
|
||||
<TagsPopOver currentCollection={collection} />
|
||||
)}
|
||||
</Box>
|
||||
{datasetDetail.type !== 'websiteDataset' && !!collection?.chunkSize && (
|
||||
<Button
|
||||
ml={2}
|
||||
variant={'whitePrimary'}
|
||||
size={['sm', 'md']}
|
||||
onClick={() => {
|
||||
router.push({
|
||||
query: {
|
||||
datasetId,
|
||||
currentTab: TabEnum.import,
|
||||
source: ImportDataSourceEnum.reTraining,
|
||||
collectionId
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('dataset:retain_collection')}
|
||||
</Button>
|
||||
)}
|
||||
{datasetDetail.type !== 'websiteDataset' &&
|
||||
!!collection?.chunkSize &&
|
||||
collection.permission?.hasWritePer && (
|
||||
<Button
|
||||
ml={2}
|
||||
variant={'whitePrimary'}
|
||||
size={['sm', 'md']}
|
||||
onClick={() => {
|
||||
router.push({
|
||||
query: {
|
||||
datasetId,
|
||||
currentTab: TabEnum.import,
|
||||
source: ImportDataSourceEnum.reTraining,
|
||||
collectionId
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('dataset:retain_collection')}
|
||||
</Button>
|
||||
)}
|
||||
{canWrite && (
|
||||
<Button
|
||||
ml={2}
|
||||
|
@@ -12,8 +12,8 @@ import { type ApiRequestProps } from '@fastgpt/service/type/next';
|
||||
import { delCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
||||
import { authDatasetCollection } from '@fastgpt/service/support/permission/dataset/auth';
|
||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
|
||||
type RetrainingCollectionResponse = {
|
||||
collectionId: string;
|
||||
@@ -35,7 +35,7 @@ async function handler(
|
||||
authToken: true,
|
||||
authApiKey: true,
|
||||
collectionId: collectionId,
|
||||
per: ReadPermissionVal
|
||||
per: WritePermissionVal
|
||||
});
|
||||
|
||||
const sourceReadType = await (async () => {
|
||||
|
@@ -45,7 +45,7 @@ async function handler(req: NextApiRequest) {
|
||||
await Promise.all(
|
||||
datasets.map((dataset) => {
|
||||
if (dataset.type === DatasetTypeEnum.websiteDataset)
|
||||
return removeWebsiteSyncJobScheduler(String(dataset._id));
|
||||
return removeWebsiteSyncJobScheduler(dataset._id);
|
||||
})
|
||||
);
|
||||
|
||||
|
@@ -277,10 +277,10 @@ const updateSyncSchedule = async ({
|
||||
if (dataset.type === DatasetTypeEnum.websiteDataset) {
|
||||
if (autoSync) {
|
||||
// upsert Job Scheduler
|
||||
upsertWebsiteSyncJobScheduler({ datasetId: String(dataset._id) });
|
||||
return upsertWebsiteSyncJobScheduler({ datasetId: dataset._id });
|
||||
} else {
|
||||
// remove Job Scheduler
|
||||
removeWebsiteSyncJobScheduler(String(dataset._id));
|
||||
return removeWebsiteSyncJobScheduler(dataset._id);
|
||||
}
|
||||
} else {
|
||||
// Other dataset, update the collection sync
|
||||
|
Reference in New Issue
Block a user