mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
feat: system config type;fix: retraining permission (#4772)
* feat: system config type * fix: retraining permission
This commit is contained in:
@@ -28,4 +28,5 @@ weight: 792
|
|||||||
2. 打开知识库搜索参数后,重排选项自动被打开。
|
2. 打开知识库搜索参数后,重排选项自动被打开。
|
||||||
3. LLM json_schema 模式 API 请求格式错误。
|
3. LLM json_schema 模式 API 请求格式错误。
|
||||||
4. 重新训练时,图片过期索引未成功清除,导致图片会丢失。
|
4. 重新训练时,图片过期索引未成功清除,导致图片会丢失。
|
||||||
|
5. 重新训练权限问题。
|
||||||
|
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
export enum SystemConfigsTypeEnum {
|
export enum SystemConfigsTypeEnum {
|
||||||
fastgpt = 'fastgpt',
|
fastgpt = 'fastgpt',
|
||||||
fastgptPro = 'fastgptPro',
|
fastgptPro = 'fastgptPro',
|
||||||
systemMsgModal = 'systemMsgModal'
|
systemMsgModal = 'systemMsgModal',
|
||||||
|
license = 'license'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SystemConfigsTypeMap = {
|
export const SystemConfigsTypeMap = {
|
||||||
@@ -13,5 +14,8 @@ export const SystemConfigsTypeMap = {
|
|||||||
},
|
},
|
||||||
[SystemConfigsTypeEnum.systemMsgModal]: {
|
[SystemConfigsTypeEnum.systemMsgModal]: {
|
||||||
label: 'systemMsgModal'
|
label: 'systemMsgModal'
|
||||||
|
},
|
||||||
|
[SystemConfigsTypeEnum.license]: {
|
||||||
|
label: 'license'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { jsonRes } from '../response';
|
import { jsonRes } from '../response';
|
||||||
import type { NextApiResponse } from 'next';
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
import { withNextCors } from './cors';
|
import { withNextCors } from './cors';
|
||||||
import { type ApiRequestProps } from '../../type/next';
|
import { type ApiRequestProps } from '../../type/next';
|
||||||
import { addLog } from '../system/log';
|
import { addLog } from '../system/log';
|
||||||
@@ -9,14 +9,21 @@ export type NextApiHandler<T = any> = (
|
|||||||
res: NextApiResponse<T>
|
res: NextApiResponse<T>
|
||||||
) => unknown | Promise<unknown>;
|
) => unknown | Promise<unknown>;
|
||||||
|
|
||||||
export const NextEntry = ({ beforeCallback = [] }: { beforeCallback?: Promise<any>[] }) => {
|
export const NextEntry = ({
|
||||||
|
beforeCallback = []
|
||||||
|
}: {
|
||||||
|
beforeCallback?: ((req: NextApiRequest, res: NextApiResponse) => Promise<any>)[];
|
||||||
|
}) => {
|
||||||
return (...args: NextApiHandler[]): NextApiHandler => {
|
return (...args: NextApiHandler[]): NextApiHandler => {
|
||||||
return async function api(req: ApiRequestProps, res: NextApiResponse) {
|
return async function api(req: ApiRequestProps, res: NextApiResponse) {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
addLog.debug(`Request start ${req.url}`);
|
addLog.debug(`Request start ${req.url}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all([withNextCors(req, res), ...beforeCallback]);
|
await Promise.all([
|
||||||
|
withNextCors(req, res),
|
||||||
|
...beforeCallback.map((item) => item(req, res))
|
||||||
|
]);
|
||||||
|
|
||||||
let response = null;
|
let response = null;
|
||||||
for await (const handler of args) {
|
for await (const handler of args) {
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
"@xmldom/xmldom": "^0.8.10",
|
"@xmldom/xmldom": "^0.8.10",
|
||||||
"@zilliz/milvus2-sdk-node": "2.4.2",
|
"@zilliz/milvus2-sdk-node": "2.4.2",
|
||||||
"axios": "^1.8.2",
|
"axios": "^1.8.2",
|
||||||
"bullmq": "^5.44.0",
|
"bullmq": "^5.52.2",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"cheerio": "1.0.0-rc.12",
|
"cheerio": "1.0.0-rc.12",
|
||||||
"cookie": "^0.7.1",
|
"cookie": "^0.7.1",
|
||||||
|
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
@@ -191,8 +191,8 @@ importers:
|
|||||||
specifier: ^1.8.2
|
specifier: ^1.8.2
|
||||||
version: 1.8.4
|
version: 1.8.4
|
||||||
bullmq:
|
bullmq:
|
||||||
specifier: ^5.44.0
|
specifier: ^5.52.2
|
||||||
version: 5.44.0
|
version: 5.52.2
|
||||||
chalk:
|
chalk:
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.4.1
|
version: 5.4.1
|
||||||
@@ -4193,8 +4193,8 @@ packages:
|
|||||||
buffer@6.0.3:
|
buffer@6.0.3:
|
||||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||||
|
|
||||||
bullmq@5.44.0:
|
bullmq@5.52.2:
|
||||||
resolution: {integrity: sha512-OnEtkuXyrUx2Jm5BpH92+ttrobblBdCbkhOe3OoR0hxZuAilI3mPWlwELslhfImRpDv8rK+C/0/VK7I8f3xIig==}
|
resolution: {integrity: sha512-fK/dKIv8ymyys4K+zeNEPA+yuYWzRPmBWUmwIMz8DvYekadl8VG19yUx94Na0n0cLAi+spdn3a/+ufkYK7CBUg==}
|
||||||
|
|
||||||
bundle-n-require@1.1.2:
|
bundle-n-require@1.1.2:
|
||||||
resolution: {integrity: sha512-bEk2jakVK1ytnZ9R2AAiZEeK/GxPUM8jvcRxHZXifZDMcjkI4EG/GlsJ2YGSVYT9y/p/gA9/0yDY8rCGsSU6Tg==}
|
resolution: {integrity: sha512-bEk2jakVK1ytnZ9R2AAiZEeK/GxPUM8jvcRxHZXifZDMcjkI4EG/GlsJ2YGSVYT9y/p/gA9/0yDY8rCGsSU6Tg==}
|
||||||
@@ -13902,7 +13902,7 @@ snapshots:
|
|||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
ieee754: 1.2.1
|
ieee754: 1.2.1
|
||||||
|
|
||||||
bullmq@5.44.0:
|
bullmq@5.52.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
cron-parser: 4.9.0
|
cron-parser: 4.9.0
|
||||||
ioredis: 5.6.0
|
ioredis: 5.6.0
|
||||||
@@ -15142,7 +15142,7 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.56.0):
|
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0(eslint-plugin-import@2.31.0)(eslint@8.56.0))(eslint@8.56.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 3.2.7
|
debug: 3.2.7
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@@ -15153,7 +15153,7 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.57.1):
|
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1):
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 3.2.7
|
debug: 3.2.7
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
@@ -15175,7 +15175,7 @@ snapshots:
|
|||||||
doctrine: 2.1.0
|
doctrine: 2.1.0
|
||||||
eslint: 8.56.0
|
eslint: 8.56.0
|
||||||
eslint-import-resolver-node: 0.3.9
|
eslint-import-resolver-node: 0.3.9
|
||||||
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.56.0)
|
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0(eslint-plugin-import@2.31.0)(eslint@8.56.0))(eslint@8.56.0)
|
||||||
hasown: 2.0.2
|
hasown: 2.0.2
|
||||||
is-core-module: 2.16.1
|
is-core-module: 2.16.1
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
@@ -15204,7 +15204,7 @@ snapshots:
|
|||||||
doctrine: 2.1.0
|
doctrine: 2.1.0
|
||||||
eslint: 8.57.1
|
eslint: 8.57.1
|
||||||
eslint-import-resolver-node: 0.3.9
|
eslint-import-resolver-node: 0.3.9
|
||||||
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.57.1)
|
eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1)
|
||||||
hasown: 2.0.2
|
hasown: 2.0.2
|
||||||
is-core-module: 2.16.1
|
is-core-module: 2.16.1
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
|
@@ -140,7 +140,9 @@ const DataCard = () => {
|
|||||||
<TagsPopOver currentCollection={collection} />
|
<TagsPopOver currentCollection={collection} />
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
{datasetDetail.type !== 'websiteDataset' && !!collection?.chunkSize && (
|
{datasetDetail.type !== 'websiteDataset' &&
|
||||||
|
!!collection?.chunkSize &&
|
||||||
|
collection.permission?.hasWritePer && (
|
||||||
<Button
|
<Button
|
||||||
ml={2}
|
ml={2}
|
||||||
variant={'whitePrimary'}
|
variant={'whitePrimary'}
|
||||||
|
@@ -12,8 +12,8 @@ import { type ApiRequestProps } from '@fastgpt/service/type/next';
|
|||||||
import { delCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
import { delCollection } from '@fastgpt/service/core/dataset/collection/controller';
|
||||||
import { authDatasetCollection } from '@fastgpt/service/support/permission/dataset/auth';
|
import { authDatasetCollection } from '@fastgpt/service/support/permission/dataset/auth';
|
||||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
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 { i18nT } from '@fastgpt/web/i18n/utils';
|
||||||
|
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||||
|
|
||||||
type RetrainingCollectionResponse = {
|
type RetrainingCollectionResponse = {
|
||||||
collectionId: string;
|
collectionId: string;
|
||||||
@@ -35,7 +35,7 @@ async function handler(
|
|||||||
authToken: true,
|
authToken: true,
|
||||||
authApiKey: true,
|
authApiKey: true,
|
||||||
collectionId: collectionId,
|
collectionId: collectionId,
|
||||||
per: ReadPermissionVal
|
per: WritePermissionVal
|
||||||
});
|
});
|
||||||
|
|
||||||
const sourceReadType = await (async () => {
|
const sourceReadType = await (async () => {
|
||||||
|
@@ -45,7 +45,7 @@ async function handler(req: NextApiRequest) {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
datasets.map((dataset) => {
|
datasets.map((dataset) => {
|
||||||
if (dataset.type === DatasetTypeEnum.websiteDataset)
|
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 (dataset.type === DatasetTypeEnum.websiteDataset) {
|
||||||
if (autoSync) {
|
if (autoSync) {
|
||||||
// upsert Job Scheduler
|
// upsert Job Scheduler
|
||||||
upsertWebsiteSyncJobScheduler({ datasetId: String(dataset._id) });
|
return upsertWebsiteSyncJobScheduler({ datasetId: dataset._id });
|
||||||
} else {
|
} else {
|
||||||
// remove Job Scheduler
|
// remove Job Scheduler
|
||||||
removeWebsiteSyncJobScheduler(String(dataset._id));
|
return removeWebsiteSyncJobScheduler(dataset._id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Other dataset, update the collection sync
|
// Other dataset, update the collection sync
|
||||||
|
Reference in New Issue
Block a user