fix: 修改字段名称
This commit is contained in:
@@ -24,9 +24,9 @@ func (s *Server) Stats(c *gin.Context) {
|
|||||||
|
|
||||||
// 2. Get request counts per group
|
// 2. Get request counts per group
|
||||||
s.DB.Table("api_keys").
|
s.DB.Table("api_keys").
|
||||||
Select("groups.nickname as group_nickname, SUM(api_keys.request_count) as request_count").
|
Select("groups.display_name as display_name, SUM(api_keys.request_count) as request_count").
|
||||||
Joins("join groups on groups.id = api_keys.group_id").
|
Joins("join groups on groups.id = api_keys.group_id").
|
||||||
Group("groups.id, groups.nickname").
|
Group("groups.id, groups.display_name").
|
||||||
Order("request_count DESC").
|
Order("request_count DESC").
|
||||||
Scan(&groupStats)
|
Scan(&groupStats)
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ type GroupConfig struct {
|
|||||||
type Group struct {
|
type Group struct {
|
||||||
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
||||||
Name string `gorm:"type:varchar(255);not null;unique" json:"name"`
|
Name string `gorm:"type:varchar(255);not null;unique" json:"name"`
|
||||||
Nickname string `gorm:"type:varchar(255)" json:"nickname"`
|
DisplayName string `gorm:"type:varchar(255)" json:"display_name"`
|
||||||
Description string `gorm:"type:varchar(512)" json:"description"`
|
Description string `gorm:"type:varchar(512)" json:"description"`
|
||||||
Upstreams Upstreams `gorm:"type:json;not null" json:"upstreams"`
|
Upstreams Upstreams `gorm:"type:json;not null" json:"upstreams"`
|
||||||
ChannelType string `gorm:"type:varchar(50);not null" json:"channel_type"`
|
ChannelType string `gorm:"type:varchar(50);not null" json:"channel_type"`
|
||||||
@@ -94,7 +94,7 @@ type RequestLog struct {
|
|||||||
|
|
||||||
// GroupRequestStat 用于表示每个分组的请求统计
|
// GroupRequestStat 用于表示每个分组的请求统计
|
||||||
type GroupRequestStat struct {
|
type GroupRequestStat struct {
|
||||||
GroupNickname string `json:"group_nickname"`
|
DisplayName string `json:"display_name"`
|
||||||
RequestCount int64 `json:"request_count"`
|
RequestCount int64 `json:"request_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,18 +11,44 @@ export interface APIKey {
|
|||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UpstreamInfo {
|
||||||
|
url: string;
|
||||||
|
weight: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Group {
|
export interface Group {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
nickname: string;
|
display_name: string;
|
||||||
description: string;
|
description: string;
|
||||||
channel_type: "openai" | "gemini";
|
sort: number;
|
||||||
config: string;
|
channel_type: "openai" | "gemini" | "silicon" | "chutes";
|
||||||
|
upstreams: UpstreamInfo[];
|
||||||
|
config: Record<string, unknown>;
|
||||||
api_keys?: APIKey[];
|
api_keys?: APIKey[];
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GroupStats {
|
||||||
|
total_keys: number;
|
||||||
|
active_keys: number;
|
||||||
|
requests_1h: number;
|
||||||
|
requests_24h: number;
|
||||||
|
requests_7d: number;
|
||||||
|
failure_rate_24h: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TaskInfo {
|
||||||
|
is_running: boolean;
|
||||||
|
task_name?: string;
|
||||||
|
group_id?: number;
|
||||||
|
group_name?: string;
|
||||||
|
processed?: number;
|
||||||
|
total?: number;
|
||||||
|
started_at?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface RequestLog {
|
export interface RequestLog {
|
||||||
id: string;
|
id: string;
|
||||||
timestamp: string;
|
timestamp: string;
|
||||||
@@ -59,6 +85,6 @@ export interface DashboardStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GroupRequestStat {
|
export interface GroupRequestStat {
|
||||||
group_nickname: string;
|
display_name: string;
|
||||||
request_count: number;
|
request_count: number;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user