big update

This commit is contained in:
stardrophere
2026-03-11 20:52:58 +08:00
parent 8ed819a580
commit 966bcfbba4
44 changed files with 7124 additions and 650 deletions
+19 -12
View File
@@ -1,23 +1,30 @@
# app/schemas/event_schema.py
from pydantic import BaseModel
from pydantic import BaseModel, Field
from typing import List, Optional
from datetime import datetime
class PlatformTrendResponse(BaseModel):
source_id: int
platform_name: str # 平台名称,如 "微博热搜"
headline: str # 平台对应的具体热搜标题
url: Optional[str] # 跳转链接
current_ranking: Optional[int] # 当前排名
ranking_history: List[int] # 排名历史轨迹,如 [50, 45, 20, 5, 1],供 ApexCharts 渲染
platform_name: str
headline: str
url: Optional[str]
current_ranking: Optional[int]
ranking_history: List[int]
class UnifiedEventResponse(BaseModel):
event_id: int
unified_title: str # AI 生成的统一大标题
summary: Optional[str] # AI 生成的摘要
hot_score: int # 总热度值
created_at: datetime # 事件发现时间
platforms: List[PlatformTrendResponse] # 挂载的各个平台子热搜
# tags: List[str] = [] # 如果后续打通了 ExtractedTopic,可以在这里返回标签
unified_title: str
summary: Optional[str]
hot_score: int
created_at: datetime
platforms: List[PlatformTrendResponse]
tags: List[str] = Field(default_factory=list)
class PaginatedUnifiedEventResponse(BaseModel):
"""分页包装:避免一次性返回全量数据"""
total: int
has_more: bool
data: List[UnifiedEventResponse]