mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-06 07:28:56 +00:00
v4.5.1 (#417)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { App } from '../mongo';
|
||||
import { MongoDataset } from '@fastgpt/core/dataset/schema';
|
||||
import { MongoDataset } from '@fastgpt/service/core/dataset/schema';
|
||||
import type { AppSchema } from '@/types/mongoSchema';
|
||||
import { ERROR_ENUM } from '@fastgpt/common/constant/errorCode';
|
||||
import { ERROR_ENUM } from '@fastgpt/global/common/error/errorCode';
|
||||
|
||||
// 模型使用权校验
|
||||
export const authApp = async ({
|
||||
@@ -37,13 +37,13 @@ export const authApp = async ({
|
||||
};
|
||||
|
||||
// 知识库操作权限
|
||||
export const authDataset = async ({ kbId, userId }: { kbId: string; userId: string }) => {
|
||||
const kb = await MongoDataset.findOne({
|
||||
_id: kbId,
|
||||
export const authDataset = async ({ datasetId, userId }: { datasetId: string; userId: string }) => {
|
||||
const dataset = await MongoDataset.findOne({
|
||||
_id: datasetId,
|
||||
userId
|
||||
});
|
||||
if (kb) {
|
||||
return kb;
|
||||
if (dataset) {
|
||||
return dataset;
|
||||
}
|
||||
return Promise.reject(ERROR_ENUM.unAuthKb);
|
||||
return Promise.reject(ERROR_ENUM.unAuthDataset);
|
||||
};
|
||||
|
@@ -1,10 +1,17 @@
|
||||
import type { NextApiResponse } from 'next';
|
||||
import { generateQA } from '../events/generateQA';
|
||||
import { generateVector } from '../events/generateVector';
|
||||
|
||||
/* start task */
|
||||
export const startQueue = () => {
|
||||
export const startQueue = (limit?: number) => {
|
||||
if (!global.systemEnv) return;
|
||||
|
||||
if (limit) {
|
||||
for (let i = 0; i < limit; i++) {
|
||||
generateVector();
|
||||
generateQA();
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < global.systemEnv.qaMaxProcess; i++) {
|
||||
generateQA();
|
||||
}
|
||||
|
Reference in New Issue
Block a user