56 lines
1.9 KiB
Python
56 lines
1.9 KiB
Python
"""
|
|
控制台仪表盘相关 Schema
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from typing import List, Optional
|
|
|
|
|
|
class CoreStats(BaseModel):
|
|
"""核心指标统计"""
|
|
total_users: int = Field(0, description="虚拟用户总数")
|
|
active_users: int = Field(0, description="已启用用户数")
|
|
disabled_users: int = Field(0, description="已禁用用户数")
|
|
|
|
today_comments: int = Field(0, description="今日评论数")
|
|
today_replies: int = Field(0, description="今日回复数")
|
|
today_likes: int = Field(0, description="今日点赞数")
|
|
today_favorites: int = Field(0, description="今日收藏数")
|
|
today_shares: int = Field(0, description="今日转发数")
|
|
|
|
yesterday_comments: int = Field(0, description="昨日评论数")
|
|
yesterday_replies: int = Field(0, description="昨日回复数")
|
|
|
|
month_tokens: int = Field(0, description="当月 Token 消耗")
|
|
today_tokens: int = Field(0, description="今日 Token 消耗")
|
|
remaining_tokens: int = Field(0, description="今日剩余 Token")
|
|
|
|
|
|
class DashboardTokenStats(BaseModel):
|
|
"""Token 统计"""
|
|
today_used: int = Field(0, description="今日已用")
|
|
today_limit: int = Field(0, description="今日限额")
|
|
today_remaining: int = Field(0, description="今日剩余")
|
|
usage_percentage: float = Field(0, description="使用百分比")
|
|
|
|
|
|
class DailyUsageItem(BaseModel):
|
|
"""每日使用项"""
|
|
date: str
|
|
tokens: int
|
|
comments: int
|
|
replies: int
|
|
|
|
|
|
class MonthlyUsageItem(BaseModel):
|
|
"""每月使用项"""
|
|
month: str
|
|
tokens: int
|
|
|
|
|
|
class DashboardStats(BaseModel):
|
|
"""控制台统计数据"""
|
|
core_stats: CoreStats
|
|
daily_token_usages: List[DailyUsageItem] = Field(default_factory=list)
|
|
monthly_token_usages: List[MonthlyUsageItem] = Field(default_factory=list)
|
|
recent_interactions: List[dict] = Field(default_factory=list)
|