50 lines
2.1 KiB
Python
50 lines
2.1 KiB
Python
# app/dto/response/chat_history_response.py
|
|
"""
|
|
HealthSync AI 채팅 히스토리 응답 DTO
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import List, Optional
|
|
|
|
|
|
class ChatHistoryItem(BaseModel):
|
|
"""개별 채팅 기록 항목"""
|
|
message_id: int = Field(..., description="메시지 ID")
|
|
message_type: str = Field(..., description="메시지 타입")
|
|
message_content: Optional[str] = Field(None, description="사용자 질문 내용 (축하/독려 메시지의 경우 null)")
|
|
response_content: str = Field(..., description="AI 응답 내용")
|
|
created_at: datetime = Field(..., description="생성 시간")
|
|
|
|
class Config:
|
|
json_encoders = {
|
|
datetime: lambda v: v.isoformat()
|
|
}
|
|
|
|
|
|
class ChatHistoryResponse(BaseModel):
|
|
"""채팅 히스토리 응답 DTO"""
|
|
chat_history: List[ChatHistoryItem] = Field(..., description="채팅 기록 목록")
|
|
total_count: int = Field(..., description="전체 채팅 수")
|
|
|
|
class Config:
|
|
json_schema_extra = {
|
|
"example": {
|
|
"chat_history": [
|
|
{
|
|
"message_id": 15,
|
|
"message_type": "consultation",
|
|
"message_content": "혈압이 높은데 어떻게 관리해야 하나요?",
|
|
"response_content": "혈압 관리를 위해서는 규칙적인 유산소 운동과 저염식 식단을 권장합니다.",
|
|
"created_at": "2025-06-16T14:30:00.000Z"
|
|
},
|
|
{
|
|
"message_id": 12,
|
|
"message_type": "consultation",
|
|
"message_content": "콜레스테롤 수치가 높다고 나왔는데 음식 조절 방법을 알려주세요.",
|
|
"response_content": "콜레스테롤 관리를 위해 포화지방 섭취를 줄이고 오메가3가 풍부한 생선을 섭취하시기 바랍니다.",
|
|
"created_at": "2025-06-15T10:15:00.000Z"
|
|
}
|
|
],
|
|
"total_count": 2
|
|
}
|
|
} |