- FastAPI + WebSocket 백엔드 (ws_relay, webhook, messages 라우터) - GUARDiA-Bot: @bot 명령 응답 + 선제적 맥락 분석 (DB 지연, 디스크, 장애 감지) - 승인 워크플로우: 재기동/배포 SR → 승인/반려 인터랙티브 버튼 - 다크 테마 Slack형 프론트엔드 (5개 채널, 실시간 메시지) - 채널: 일반/배포/운영/PM관리/알림 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional, List
|
|
from datetime import datetime
|
|
from uuid import uuid4
|
|
|
|
|
|
def new_msg_id() -> str:
|
|
return f"MSG-{datetime.now().strftime('%Y%m%d')}-{str(uuid4())[:8].upper()}"
|
|
|
|
|
|
class InteractiveAction(BaseModel):
|
|
type: str # BUTTON | APPROVAL_BUTTONS
|
|
label: Optional[str] = None
|
|
command_code: Optional[str] = None
|
|
approve_url: Optional[str] = None
|
|
reject_url: Optional[str] = None
|
|
|
|
|
|
class Message(BaseModel):
|
|
message_id: str = Field(default_factory=new_msg_id)
|
|
timestamp: str = Field(default_factory=lambda: datetime.now().isoformat())
|
|
room_id: str
|
|
sender: str
|
|
sender_type: str = "HUMAN" # HUMAN | BOT
|
|
msg_type: str = "CHAT"
|
|
content: str
|
|
is_widget: bool = False
|
|
interactive_action: Optional[InteractiveAction] = None
|
|
|
|
|
|
class WebhookPayload(BaseModel):
|
|
user_id: str
|
|
text: str
|
|
room_id: str
|
|
files: List[dict] = []
|
|
bot: bool = False
|
|
|
|
|
|
class IncomingChat(BaseModel):
|
|
content: str
|
|
room_id: str
|