4.8.5 test fix (#1835)
* faq * perf: navbar name and fix dataset selector * feat: app tag * perf: icon * fix: update workflow bug * perf: dataset ui * perf: menu * fix: ts * fix: auth file and app list ui * app list * app list * perf: init api * update per * log level
This commit is contained in:
@@ -69,7 +69,10 @@ async function handler(
|
||||
|
||||
/* temp: get all apps and per */
|
||||
const [myApps, rpList] = await Promise.all([
|
||||
MongoApp.find(findAppsQuery, '_id avatar type name intro tmbId pluginData defaultPermission')
|
||||
MongoApp.find(
|
||||
findAppsQuery,
|
||||
'_id avatar type name intro tmbId updateTime pluginData defaultPermission'
|
||||
)
|
||||
.sort({
|
||||
updateTime: -1
|
||||
})
|
||||
@@ -101,10 +104,12 @@ async function handler(
|
||||
|
||||
return sliceApps.map((app) => ({
|
||||
_id: app._id,
|
||||
tmbId: app.tmbId,
|
||||
avatar: app.avatar,
|
||||
type: app.type,
|
||||
name: app.name,
|
||||
intro: app.intro,
|
||||
updateTime: app.updateTime,
|
||||
permission: app.permission,
|
||||
defaultPermission: app.defaultPermission || AppDefaultPermissionVal,
|
||||
pluginData: app.pluginData
|
||||
|
||||
@@ -48,7 +48,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
|
||||
...(type && { type }),
|
||||
...(avatar && { avatar }),
|
||||
...(intro !== undefined && { intro }),
|
||||
...(defaultPermission && { defaultPermission }),
|
||||
...(defaultPermission !== undefined && { defaultPermission }),
|
||||
...(teamTags && { teamTags }),
|
||||
...(formatNodes && {
|
||||
modules: formatNodes
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { NextApiRequest } from 'next';
|
||||
import { authDatasetFile } from '@fastgpt/service/support/permission/dataset/auth';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
|
||||
async function handler(req: NextApiRequest) {
|
||||
const { fileId } = req.query as { fileId: string };
|
||||
// 凭证校验
|
||||
const { file } = await authDatasetFile({ req, authToken: true, fileId, per: ReadPermissionVal });
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
export default NextAPI(handler);
|
||||
@@ -1,10 +1,10 @@
|
||||
import { authDatasetFile } from '@fastgpt/service/support/permission/dataset/auth';
|
||||
import { DatasetSourceReadTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { rawText2Chunks, readDatasetSourceRawText } from '@fastgpt/service/core/dataset/read';
|
||||
import { authCert } from '@fastgpt/service/support/permission/auth/common';
|
||||
import { NextAPI } from '@/service/middleware/entry';
|
||||
import { ApiRequestProps } from '@fastgpt/service/type/next';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { OwnerPermissionVal, ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { authFile } from '@fastgpt/service/support/permission/auth/file';
|
||||
|
||||
export type PostPreviewFilesChunksProps = {
|
||||
type: DatasetSourceReadTypeEnum;
|
||||
@@ -35,12 +35,12 @@ async function handler(
|
||||
|
||||
const { teamId } = await (async () => {
|
||||
if (type === DatasetSourceReadTypeEnum.fileLocal) {
|
||||
return authDatasetFile({
|
||||
return authFile({
|
||||
req,
|
||||
authToken: true,
|
||||
authApiKey: true,
|
||||
fileId: sourceId,
|
||||
per: ReadPermissionVal
|
||||
per: OwnerPermissionVal
|
||||
});
|
||||
}
|
||||
return authCert({ req, authApiKey: true, authToken: true });
|
||||
|
||||
@@ -11,12 +11,14 @@ import {
|
||||
ReadPermissionVal
|
||||
} from '@fastgpt/global/support/permission/constant';
|
||||
import { MongoResourcePermission } from '@fastgpt/service/support/permission/schema';
|
||||
import { DatasetDefaultPermission } from '@fastgpt/global/support/permission/dataset/constant';
|
||||
import { DatasetDefaultPermissionVal } from '@fastgpt/global/support/permission/dataset/constant';
|
||||
import { ParentIdType } from '@fastgpt/global/common/parentFolder/type';
|
||||
import { parseParentIdInMongo } from '@fastgpt/global/common/parentFolder/utils';
|
||||
|
||||
export type GetDatasetListBody = { parentId: ParentIdType; type?: DatasetTypeEnum };
|
||||
|
||||
async function handler(req: NextApiRequest) {
|
||||
const { parentId, type } = req.body as { parentId: ParentIdType; type?: DatasetTypeEnum };
|
||||
const { parentId, type } = req.body as GetDatasetListBody;
|
||||
// 凭证校验
|
||||
const {
|
||||
teamId,
|
||||
@@ -28,18 +30,6 @@ async function handler(req: NextApiRequest) {
|
||||
authApiKey: true,
|
||||
per: ReadPermissionVal
|
||||
});
|
||||
console.log(
|
||||
'parentId',
|
||||
parentId,
|
||||
'type',
|
||||
type,
|
||||
'teamId',
|
||||
teamId,
|
||||
'tmbId',
|
||||
tmbId,
|
||||
'tmbPer',
|
||||
tmbPer
|
||||
);
|
||||
|
||||
const [myDatasets, rpList] = await Promise.all([
|
||||
MongoDataset.find({
|
||||
@@ -85,7 +75,7 @@ async function handler(req: NextApiRequest) {
|
||||
type: item.type,
|
||||
permission: item.permission,
|
||||
vectorModel: getVectorModel(item.vectorModel),
|
||||
defaultPermission: item.defaultPermission ?? DatasetDefaultPermission
|
||||
defaultPermission: item.defaultPermission ?? DatasetDefaultPermissionVal
|
||||
}))
|
||||
);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ async function handler(req: NextApiRequest) {
|
||||
...(status && { status }),
|
||||
...(intro && { intro }),
|
||||
...(externalReadUrl && { externalReadUrl }),
|
||||
defaultPermission
|
||||
...(defaultPermission !== undefined && { defaultPermission })
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user