mirror of
https://github.com/labring/FastGPT.git
synced 2026-03-30 01:01:15 +08:00
perf: admin get app api
This commit is contained in:
@@ -13,6 +13,7 @@ description: 'FastGPT V4.14.5 更新说明'
|
||||
5. 门户页支持配置单个应用运行可见度。
|
||||
6. 导出单个知识库集合分块接口。
|
||||
7. 升级 Mongo5.x 至 5.0.32 解决CVE-2025-14847。
|
||||
8. 邮箱配置,支持配置安全模式以及端口号。
|
||||
|
||||
## ⚙️ 优化
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
|
||||
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
|
||||
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T14:56:04+08:00",
|
||||
"document/content/docs/upgrading/4-14/4145.mdx": "2026-01-07T11:34:04+08:00",
|
||||
"document/content/docs/upgrading/4-14/4145.mdx": "2026-01-07T13:20:56+08:00",
|
||||
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
|
||||
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createDocument } from 'zod-openapi';
|
||||
import { DashboardPath } from './admin/core/dashboard';
|
||||
import { AdminCorePath } from './admin/core';
|
||||
import { TagsMap } from './tag';
|
||||
import { AdminSupportPath } from './admin/support';
|
||||
|
||||
@@ -11,7 +11,7 @@ export const adminOpenAPIDocument = createDocument({
|
||||
description: 'FastGPT Admin API 文档'
|
||||
},
|
||||
paths: {
|
||||
...DashboardPath,
|
||||
...AdminCorePath,
|
||||
...AdminSupportPath
|
||||
},
|
||||
servers: [{ url: '/api' }],
|
||||
@@ -20,6 +20,10 @@ export const adminOpenAPIDocument = createDocument({
|
||||
name: '仪表盘',
|
||||
tags: [TagsMap.adminDashboard]
|
||||
},
|
||||
{
|
||||
name: '核心资源管理',
|
||||
tags: [TagsMap.adminApps]
|
||||
},
|
||||
{
|
||||
name: '系统配置',
|
||||
tags: [TagsMap.adminInform]
|
||||
|
||||
23
packages/global/openapi/admin/core/app/api.ts
Normal file
23
packages/global/openapi/admin/core/app/api.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { z } from 'zod';
|
||||
import { PaginationSchema, PaginationResponseSchema } from '../../../api';
|
||||
|
||||
// App type schema
|
||||
export const AppItemSchema = z.object({
|
||||
id: z.string().meta({ description: '应用ID' }),
|
||||
username: z.string().meta({ description: '用户名' }),
|
||||
userId: z.string().meta({ description: '用户ID' }),
|
||||
name: z.string().meta({ description: '应用名称' }),
|
||||
intro: z.string().meta({ description: '应用简介' }),
|
||||
teamName: z.string().meta({ description: '团队名称' })
|
||||
});
|
||||
export type AppItemType = z.infer<typeof AppItemSchema>;
|
||||
|
||||
// Get apps request body schema
|
||||
export const GetAppsBodySchema = PaginationSchema.extend({
|
||||
searchKey: z.string().nullish().meta({ description: '搜索关键词(支持应用名称和应用ID)' })
|
||||
});
|
||||
export type GetAppsBodyType = z.infer<typeof GetAppsBodySchema>;
|
||||
|
||||
// Get apps response schema
|
||||
export const GetAppsResponseSchema = PaginationResponseSchema(AppItemSchema);
|
||||
export type GetAppsResponseType = z.infer<typeof GetAppsResponseSchema>;
|
||||
30
packages/global/openapi/admin/core/app/index.ts
Normal file
30
packages/global/openapi/admin/core/app/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { OpenAPIPath } from '../../../type';
|
||||
import { GetAppsBodySchema, GetAppsResponseSchema } from './api';
|
||||
import { TagsMap } from '../../../tag';
|
||||
|
||||
export const AdminAppPath: OpenAPIPath = {
|
||||
'/admin/core/app/getApps': {
|
||||
post: {
|
||||
summary: '获取应用列表',
|
||||
description: '分页获取应用列表,支持按名称和ID搜索',
|
||||
tags: [TagsMap.adminApps],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetAppsBodySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取应用列表',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetAppsResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
8
packages/global/openapi/admin/core/index.ts
Normal file
8
packages/global/openapi/admin/core/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { DashboardPath } from './dashboard';
|
||||
import { AdminAppPath } from './app';
|
||||
import type { OpenAPIPath } from '../../type';
|
||||
|
||||
export const AdminCorePath: OpenAPIPath = {
|
||||
...DashboardPath,
|
||||
...AdminAppPath
|
||||
};
|
||||
@@ -41,7 +41,8 @@ export const TagsMap = {
|
||||
pluginAdmin: '管理员插件管理',
|
||||
pluginToolAdmin: '管理员系统工具管理',
|
||||
// Data
|
||||
adminDashboard: '管理员仪表盘',
|
||||
adminDashboard: '仪表盘',
|
||||
// Inform
|
||||
adminInform: '管理员通知管理'
|
||||
adminInform: '通知管理',
|
||||
adminApps: '应用管理'
|
||||
};
|
||||
|
||||
@@ -134,6 +134,8 @@ const AppSchema = new Schema(
|
||||
|
||||
AppSchema.index({ teamId: 1, updateTime: -1 });
|
||||
AppSchema.index({ teamId: 1, type: 1 });
|
||||
|
||||
// Schedule
|
||||
AppSchema.index(
|
||||
{ scheduledTriggerConfig: 1, scheduledTriggerNextTime: -1 },
|
||||
{
|
||||
@@ -142,8 +144,11 @@ AppSchema.index(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Admin count
|
||||
AppSchema.index({ type: 1 });
|
||||
AppSchema.index({ deleteTime: 1 });
|
||||
// Admin search
|
||||
AppSchema.index({ name: 1 });
|
||||
|
||||
export const MongoApp = getMongoModel<AppType>(AppCollectionName, AppSchema);
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import MyBox from '../components/common/MyBox';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { useRequest2 } from './useRequest';
|
||||
import type { PaginationType, PaginationResponseType } from '../../global/openapi/api';
|
||||
|
||||
type ItemHeight<T> = (index: number, data: T) => number;
|
||||
const thresholdVal = 100;
|
||||
@@ -179,8 +180,8 @@ export function useVirtualScrollPagination<
|
||||
}
|
||||
|
||||
export function useScrollPagination<
|
||||
TParams extends PaginationProps,
|
||||
TData extends PaginationResponse
|
||||
TParams extends PaginationType,
|
||||
TData extends PaginationResponseType<any>
|
||||
>(
|
||||
api: (data: TParams) => Promise<TData>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user