mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 04:06:18 +00:00
feat: system config type;fix: retraining permission (#4772)
* feat: system config type * fix: retraining permission
This commit is contained in:
@@ -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'
|
||||
}
|
||||
};
|
||||
|
@@ -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) {
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user