feat: 添加Bot名称字段到年度报告数据模型,并在生成报告时获取Bot名称

pull/1465/head
墨梓柒 2025-12-31 01:36:06 +08:00
parent 64f0833ec9
commit ce7b954f68
No known key found for this signature in database
GPG Key ID: 4A65B9DBA35F7635
1 changed files with 7 additions and 0 deletions

View File

@ -113,6 +113,7 @@ class AnnualReportData(BaseModel):
"""年度报告完整数据"""
year: int = Field(2025, description="报告年份")
bot_name: str = Field("麦麦", description="Bot名称")
generated_at: str = Field(..., description="报告生成时间")
time_footprint: TimeFootprintData = Field(default_factory=TimeFootprintData)
social_network: SocialNetworkData = Field(default_factory=SocialNetworkData)
@ -854,7 +855,12 @@ async def get_full_annual_report(year: int = 2025, _auth: bool = Depends(require
完整的年度报告数据
"""
try:
from src.config.config import global_config
logger.info(f"开始生成 {year} 年度报告...")
# 获取 bot 名称
bot_name = global_config.bot.nickname or "麦麦"
# 并行获取各维度数据
time_footprint = await get_time_footprint(year)
@ -865,6 +871,7 @@ async def get_full_annual_report(year: int = 2025, _auth: bool = Depends(require
report = AnnualReportData(
year=year,
bot_name=bot_name,
generated_at=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
time_footprint=time_footprint,
social_network=social_network,