28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
# app/models/chat_message.py
|
|
"""
|
|
HealthSync AI 채팅 메시지 모델
|
|
"""
|
|
from pydantic import BaseModel, Field
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from enum import Enum
|
|
|
|
class MessageType(str, Enum):
|
|
"""메시지 타입"""
|
|
CONSULTATION = "consultation" # 상담
|
|
CELEBRATION = "celebration" # 축하
|
|
ENCOURAGEMENT = "encouragement" # 독려
|
|
|
|
class ChatMessage(BaseModel):
|
|
"""채팅 메시지 모델"""
|
|
message_id: Optional[int] = Field(None, description="메시지 ID")
|
|
member_serial_number: int = Field(..., description="회원 일련번호")
|
|
message_type: str = Field(..., max_length=20, description="메시지 타입")
|
|
message_content: Optional[str] = Field(None, description="메시지 내용")
|
|
response_content: Optional[str] = Field(None, description="AI 응답 내용")
|
|
created_at: datetime = Field(default_factory=datetime.now, description="생성일시")
|
|
|
|
class Config:
|
|
json_encoders = {
|
|
datetime: lambda v: v.isoformat()
|
|
} |