feat: 增强工作台趋势概览与聊天排行

- 支持用户活跃与智能体活跃趋势统计及自定义时间范围

- 增加用户活跃榜与智能体趋势数据结构及查询实现

- 同步补齐工作台页面展示与定向测试
This commit is contained in:
2026-05-06 19:22:09 +08:00
parent 5827ecde42
commit 31b0e21d3d
20 changed files with 2087 additions and 146 deletions

View File

@@ -1,15 +1,18 @@
import { requestClient } from '#/api/request';
export type DashboardRange = '7d' | '30d' | 'today';
export type DashboardRange = '7d' | '30d' | 'custom' | 'today';
export interface DashboardOverviewQuery {
endDate?: string;
range?: DashboardRange;
startDate?: string;
}
export interface DashboardSummary {
activeUserTotal: number;
activeAssistantTotal: number;
botTotal: number;
chatActiveUserTotal: number;
chatMessageTotal: number;
chatSessionTotal: number;
knowledgeBaseTotal: number;
@@ -30,10 +33,24 @@ export interface DashboardTrendItem {
label: string;
}
export interface DashboardAssistantTrendPoint {
key: string;
label: string;
sessionTotal: number;
}
export interface DashboardAssistantTrendSeries {
assistantId?: number | string;
label: string;
points: DashboardAssistantTrendPoint[];
totalSessionCount: number;
}
export interface DashboardDistributionItem {
activeUserTotal: number;
assistantId?: number | string;
avgMessagePerSession?: number;
avgSessionPerUser?: number;
botTotal: number;
key: string;
knowledgeBaseTotal: number;
@@ -45,13 +62,23 @@ export interface DashboardDistributionItem {
workflowTotal: number;
}
export interface DashboardUserRankItem {
assistantTotal: number;
label: string;
messageTotal: number;
sessionTotal: number;
userId?: number | string;
}
export interface DashboardOverviewResponse {
assistantTrends: DashboardAssistantTrendSeries[];
chatStatus: DashboardChatStatus;
distribution: DashboardDistributionItem[];
query: DashboardOverviewQuery;
summary: DashboardSummary;
trends: DashboardTrendItem[];
updatedAt: string;
userRanks: DashboardUserRankItem[];
}
export async function getDashboardOverview(params: DashboardOverviewQuery) {