Feature/generate cache (#135)
* [feature]Generate emotions, implicit cache * [feature]Generate emotions, implicit cache * [changes]Improve the code based on AI review * [changes]Improve the code based on AI review * [changes]Improve the code * [feature]Generate emotions, implicit cache * [changes]Improve the code based on AI review * [changes]Improve the code
This commit is contained in:
@@ -262,3 +262,25 @@ InterestCategory = InterestCategoryResponse
|
||||
InterestAreaDistribution = InterestAreaDistributionResponse
|
||||
BehaviorHabit = BehaviorHabitResponse
|
||||
UserProfile = UserProfileResponse
|
||||
|
||||
|
||||
# Cache-related Schemas
|
||||
|
||||
class GenerateProfileRequest(BaseModel):
|
||||
"""生成完整用户画像请求"""
|
||||
end_user_id: str = Field(..., description="终端用户ID")
|
||||
|
||||
|
||||
class CompleteProfileResponse(BaseModel):
|
||||
"""完整用户画像响应(包含所有模块)"""
|
||||
user_id: str
|
||||
preferences: List[PreferenceTagResponse]
|
||||
portrait: DimensionPortraitResponse
|
||||
interest_areas: InterestAreaDistributionResponse
|
||||
habits: List[BehaviorHabitResponse]
|
||||
generated_at: datetime.datetime
|
||||
cached: bool = Field(False, description="是否来自缓存")
|
||||
|
||||
@field_serializer("generated_at", when_used="json")
|
||||
def _serialize_generated_at(self, dt: datetime.datetime):
|
||||
return int(dt.timestamp() * 1000) if dt else None
|
||||
|
||||
Reference in New Issue
Block a user