feat: system config type;fix: retraining permission (#4772)

* feat: system config type

* fix: retraining permission
This commit is contained in:
Archer
2025-05-08 22:09:55 +08:00
committed by GitHub
parent 12d6948ba7
commit 657fa32217
9 changed files with 52 additions and 38 deletions

View File

@@ -1,7 +1,8 @@
export enum SystemConfigsTypeEnum {
fastgpt = 'fastgpt',
fastgptPro = 'fastgptPro',
systemMsgModal = 'systemMsgModal'
systemMsgModal = 'systemMsgModal',
license = 'license'
}
export const SystemConfigsTypeMap = {
@@ -13,5 +14,8 @@ export const SystemConfigsTypeMap = {
},
[SystemConfigsTypeEnum.systemMsgModal]: {
label: 'systemMsgModal'
},
[SystemConfigsTypeEnum.license]: {
label: 'license'
}
};

View File

@@ -1,5 +1,5 @@
import { jsonRes } from '../response';
import type { NextApiResponse } from 'next';
import type { NextApiRequest, NextApiResponse } from 'next';
import { withNextCors } from './cors';
import { type ApiRequestProps } from '../../type/next';
import { addLog } from '../system/log';
@@ -9,14 +9,21 @@ export type NextApiHandler<T = any> = (
res: NextApiResponse<T>
) => 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 async function api(req: ApiRequestProps, res: NextApiResponse) {
const start = Date.now();
addLog.debug(`Request start ${req.url}`);
try {
await Promise.all([withNextCors(req, res), ...beforeCallback]);
await Promise.all([
withNextCors(req, res),
...beforeCallback.map((item) => item(req, res))
]);
let response = null;
for await (const handler of args) {

View File

@@ -8,7 +8,7 @@
"@xmldom/xmldom": "^0.8.10",
"@zilliz/milvus2-sdk-node": "2.4.2",
"axios": "^1.8.2",
"bullmq": "^5.44.0",
"bullmq": "^5.52.2",
"chalk": "^5.3.0",
"cheerio": "1.0.0-rc.12",
"cookie": "^0.7.1",