feat: chat slider support folder (#1759)

* feat: docker-compose version

* feat: chat slider support folder

* lazy behavior

* pref: code sandbox size
This commit is contained in:
Archer
2024-06-13 23:09:36 +08:00
committed by GitHub
parent 6385794603
commit f7f4a8de4d
20 changed files with 336 additions and 152 deletions

View File

@@ -16,8 +16,9 @@ import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { AppDefaultPermissionVal } from '@fastgpt/global/support/permission/app/constant';
export type ListAppBody = {
parentId: ParentIdType;
parentId?: ParentIdType;
type?: AppTypeEnum;
getRecentlyChat?: boolean;
};
async function handler(
@@ -35,14 +36,23 @@ async function handler(
per: ReadPermissionVal
});
const { parentId, type } = req.body;
const { parentId, type, getRecentlyChat } = req.body;
const findAppsQuery = getRecentlyChat
? {
// get all chat app
teamId,
type: { $in: [AppTypeEnum.advanced, AppTypeEnum.simple] }
}
: {
teamId,
...(type && { type }),
...parseParentIdInMongo(parentId)
};
/* temp: get all apps and per */
const [myApps, rpList] = await Promise.all([
MongoApp.find(
{ teamId, ...(type && { type }), ...parseParentIdInMongo(parentId) },
'_id avatar type name intro tmbId defaultPermission'
)
MongoApp.find(findAppsQuery, '_id avatar type name intro tmbId defaultPermission')
.sort({
updateTime: -1
})
@@ -69,7 +79,9 @@ async function handler(
})
.filter((app) => app.permission.hasReadPer);
return filterApps.map((app) => ({
const sliceApps = getRecentlyChat ? filterApps.slice(0, 15) : filterApps;
return sliceApps.map((app) => ({
_id: app._id,
avatar: app.avatar,
type: app.type,