mirror of
https://github.com/stardrophere/InsightRadar.git
synced 2026-06-06 00:57:51 +08:00
login+ai cluster
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from app.models.models import GenderType
|
||||
|
||||
|
||||
EMAIL_PATTERN = r"^[^@\s]+@[^@\s]+\.[^@\s]+$"
|
||||
|
||||
|
||||
class RegisterCodeSendRequest(BaseModel):
|
||||
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
|
||||
|
||||
|
||||
class LoginCodeSendRequest(BaseModel):
|
||||
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
|
||||
password: str = Field(..., min_length=8, max_length=128)
|
||||
verification_code: str = Field(..., pattern=r"^\d{6}$")
|
||||
nickname: Optional[str] = Field(default=None, max_length=100)
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
|
||||
password: str = Field(..., min_length=8, max_length=128)
|
||||
|
||||
|
||||
class LoginWithCodeRequest(BaseModel):
|
||||
email: str = Field(..., max_length=150, pattern=EMAIL_PATTERN)
|
||||
verification_code: str = Field(..., pattern=r"^\d{6}$")
|
||||
|
||||
|
||||
class UserProfileResponse(BaseModel):
|
||||
id: int
|
||||
email: str
|
||||
nickname: Optional[str]
|
||||
avatar_url: Optional[str]
|
||||
gender: GenderType
|
||||
created_at: datetime
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class AuthTokenResponse(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
expires_in: int
|
||||
user: UserProfileResponse
|
||||
|
||||
|
||||
class MessageResponse(BaseModel):
|
||||
message: str
|
||||
@@ -0,0 +1,23 @@
|
||||
# app/schemas/event_schema.py
|
||||
from pydantic import BaseModel
|
||||
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 渲染
|
||||
|
||||
|
||||
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,可以在这里返回标签
|
||||
@@ -1,4 +1,4 @@
|
||||
# app/schemas/schemas.py
|
||||
# app/schemas/source_schema.py
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
Reference in New Issue
Block a user