mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
feat: custom domain (#6067)
* perf: faq * index * delete dataset * delete dataset * perf: delete dataset * init * fix: faq * doc * fix: share link auth (#6063) * standard plan add custom domain config (#6061) * standard plan add custom domain config * bill detail modal * perf: vector count api * feat: custom domain & wecom bot SaaS integration (#6047) * feat: custom Domain type define * feat: custom domain * feat: wecom custom domain * chore: i18n * chore: i18n; team auth * feat: wecom multi-model message support * chore: wecom edit modal * chore(doc): custom domain && wecom bot * fix: type * fix: type * fix: file detect * feat: fe * fix: img name * fix: test * compress img * rename * editor initial status * fix: chat url * perf: s3 upload by buffer * img * refresh * fix: custom domain selector (#6069) * empty tip * perf: s3 init * sort provider * fix: extend * perf: extract filename --------- Co-authored-by: Roy <whoeverimf5@gmail.com> Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
import { z } from 'zod';
|
||||
import { UsageSourceEnum } from '../../../../support/wallet/usage/constants';
|
||||
|
||||
// Common query schema
|
||||
export const GetDataChartsQuerySchema = z.object({
|
||||
startTime: z.string().meta({ description: '查询起始时间(ISO 8601 格式)' }),
|
||||
sources: z.array(z.enum(UsageSourceEnum)).optional().meta({ description: '使用来源筛选' })
|
||||
});
|
||||
export type GetDataChartsQueryType = z.infer<typeof GetDataChartsQuerySchema>;
|
||||
|
||||
// Get user form data response
|
||||
export const RegisteredUserCountSchema = z.object({
|
||||
date: z.string().meta({ description: '注册日期' }),
|
||||
count: z.number().meta({ description: '该日期注册的用户数' })
|
||||
});
|
||||
export const GetUserFormDataResponseSchema = z.object({
|
||||
startUserCount: z.number().meta({ description: '起始时间之前的用户总数' }),
|
||||
registeredUserCount: z.array(RegisteredUserCountSchema).meta({ description: '用户注册时间序列' })
|
||||
});
|
||||
export type GetUserFormDataResponseType = z.infer<typeof GetUserFormDataResponseSchema>;
|
||||
|
||||
// Get Pays Form Data Response
|
||||
export const OrderAmountSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '订单总数' }),
|
||||
successCount: z.number().meta({ description: '成功订单数' })
|
||||
});
|
||||
export const PayAmountSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '支付总金额' })
|
||||
});
|
||||
export const PayTeamSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '支付团队数' })
|
||||
});
|
||||
export const GetPaysFormDataResponseSchema = z.object({
|
||||
orderAmounts: z.array(OrderAmountSchema).meta({ description: '订单数量时间序列' }),
|
||||
payAmounts: z.array(PayAmountSchema).meta({ description: '支付金额时间序列' }),
|
||||
payTeams: z.array(PayTeamSchema).meta({ description: '支付团队时间序列' })
|
||||
});
|
||||
export type GetPaysFormDataResponseType = z.infer<typeof GetPaysFormDataResponseSchema>;
|
||||
|
||||
// Get chat form data response
|
||||
export const ChatAmountSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '对话总数' })
|
||||
});
|
||||
export const ChatItemAmountSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '对话消息总数' }),
|
||||
averageCount: z.number().meta({ description: '每个对话的平均消息数' })
|
||||
});
|
||||
export const GetChatFormDataResponseSchema = z.object({
|
||||
chatAmounts: z.array(ChatAmountSchema).meta({ description: '对话数量时间序列' }),
|
||||
chatItemAmounts: z.array(ChatItemAmountSchema).meta({ description: '对话消息数量时间序列' })
|
||||
});
|
||||
export type GetChatFormDataResponseType = z.infer<typeof GetChatFormDataResponseSchema>;
|
||||
|
||||
// Get QPM range distribution response
|
||||
export const QpmRangeSchema = z.object({
|
||||
range: z.string().meta({ description: 'QPM 范围标签' }),
|
||||
count: z.number().meta({ description: '范围内的团队数量' })
|
||||
});
|
||||
export const GetQpmRangeResponseSchema = z.object({
|
||||
ranges: z.array(QpmRangeSchema).meta({ description: 'QPM 范围统计列表' })
|
||||
});
|
||||
export type GetQpmRangeResponseType = z.infer<typeof GetQpmRangeResponseSchema>;
|
||||
|
||||
// Get cost form data response
|
||||
export const PointUsageSchema = z.object({
|
||||
date: z.string().meta({ description: '数据点日期' }),
|
||||
totalCount: z.number().meta({ description: '积分使用总数' })
|
||||
});
|
||||
export const GetCostFormDataResponseSchema = z.object({
|
||||
pointUsages: z.array(PointUsageSchema).meta({ description: '积分使用时间序列' })
|
||||
});
|
||||
export type GetCostFormDataResponseType = z.infer<typeof GetCostFormDataResponseSchema>;
|
||||
|
||||
// Get user stats response
|
||||
export const GetUserStatsResponseSchema = z.object({
|
||||
usersCount: z.number().meta({ description: '用户总数' }),
|
||||
rechargeCount: z.number().meta({ description: '充值总数' })
|
||||
});
|
||||
export type GetUserStatsResponseType = z.infer<typeof GetUserStatsResponseSchema>;
|
||||
|
||||
// Get app stats response
|
||||
export const GetAppStatsResponseSchema = z.object({
|
||||
workflowCount: z.number().meta({ description: '工作流总数' }),
|
||||
simpleAppCount: z.number().meta({ description: '简易应用总数' }),
|
||||
workflowToolCount: z.number().meta({ description: '工作流工具总数' }),
|
||||
httpToolCount: z.number().meta({ description: 'HTTP 工具总数' }),
|
||||
mcpToolCount: z.number().meta({ description: 'MCP 工具总数' })
|
||||
});
|
||||
export type GetAppStatsResponseType = z.infer<typeof GetAppStatsResponseSchema>;
|
||||
|
||||
// Get dataset stats response
|
||||
export const GetDatasetStatsResponseSchema = z.object({
|
||||
commonDatasetCount: z.number().meta({ description: '通用知识库总数' }),
|
||||
websiteDatasetCount: z.number().meta({ description: 'Web 站点同步总数' }),
|
||||
apiDatasetCount: z.number().meta({ description: 'API 知识库总数' }),
|
||||
yuqueDatasetCount: z.number().meta({ description: '语雀知识库总数' }),
|
||||
feishuDatasetCount: z.number().meta({ description: '飞书知识库总数' }),
|
||||
totalIndexCount: z.number().meta({ description: '索引总量' })
|
||||
});
|
||||
export type GetDatasetStatsResponseType = z.infer<typeof GetDatasetStatsResponseSchema>;
|
||||
@@ -0,0 +1,190 @@
|
||||
import { z } from 'zod';
|
||||
import type { OpenAPIPath } from '../../../type';
|
||||
import {
|
||||
GetDataChartsQuerySchema,
|
||||
GetChatFormDataResponseSchema,
|
||||
GetCostFormDataResponseSchema,
|
||||
GetPaysFormDataResponseSchema,
|
||||
GetUserFormDataResponseSchema,
|
||||
GetQpmRangeResponseSchema,
|
||||
GetUserStatsResponseSchema,
|
||||
GetAppStatsResponseSchema,
|
||||
GetDatasetStatsResponseSchema
|
||||
} from './api';
|
||||
import { TagsMap } from '../../../tag';
|
||||
|
||||
export * from './api';
|
||||
|
||||
export const DashboardPath: OpenAPIPath = {
|
||||
'/admin/core/dashboard/getUserStats': {
|
||||
get: {
|
||||
summary: '获取用户全局统计',
|
||||
description: '获取用户总数和充值总数',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取用户统计',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetUserStatsResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getAppStats': {
|
||||
get: {
|
||||
summary: '获取应用全局统计',
|
||||
description: '获取工作流、简易应用、工作流工具、HTTP 工具和 MCP 工具的总数',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取应用统计',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetAppStatsResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getDatasetStats': {
|
||||
get: {
|
||||
summary: '获取知识库全局统计',
|
||||
description: '获取通用知识库、Web 站点同步、API、语雀、飞书知识库的总数以及索引总量',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取知识库统计',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetDatasetStatsResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getChatFormData': {
|
||||
get: {
|
||||
summary: '获取对话统计数据',
|
||||
description: '获取对话数量和对话消息数量的时间序列统计数据',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
requestParams: {
|
||||
query: z.object({
|
||||
startTime: z.string().meta({
|
||||
description: '查询起始时间(ISO 8601 格式)'
|
||||
})
|
||||
})
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取对话统计数据',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetChatFormDataResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getWorkflowQpmRange': {
|
||||
get: {
|
||||
summary: '获取工作流 QPM 范围分布',
|
||||
description: '按团队最大 QPM 统计各范围的团队数量',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
requestParams: {
|
||||
query: z.object({
|
||||
startTime: z.string().meta({
|
||||
description: '查询起始时间(ISO 8601 格式)'
|
||||
})
|
||||
})
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取 QPM 范围分布',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetQpmRangeResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getCostFormData': {
|
||||
post: {
|
||||
summary: '获取消费统计数据',
|
||||
description: '获取积分消耗的时间序列统计数据',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
requestBody: {
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetDataChartsQuerySchema
|
||||
}
|
||||
}
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取消费统计数据',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetCostFormDataResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getPaysFormData': {
|
||||
get: {
|
||||
summary: '获取支付统计数据',
|
||||
description: '获取订单和支付金额的时间序列统计数据',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
requestParams: {
|
||||
query: z.object({
|
||||
startTime: z.string().meta({
|
||||
description: '查询起始时间(ISO 8601 格式)'
|
||||
})
|
||||
})
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取支付统计数据',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetPaysFormDataResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'/admin/core/dashboard/getUserFormData': {
|
||||
get: {
|
||||
summary: '获取用户注册统计数据',
|
||||
description: '获取用户注册数量的时间序列统计数据',
|
||||
tags: [TagsMap.adminDashboard],
|
||||
requestParams: {
|
||||
query: z.object({
|
||||
startTime: z.string().meta({
|
||||
description: '查询起始时间(ISO 8601 格式)'
|
||||
})
|
||||
})
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: '成功获取用户统计数据',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: GetUserFormDataResponseSchema
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user