From 4073370e1b7d221776bc8cc9a2b0ff45920db6a7 Mon Sep 17 00:00:00 2001 From: gahusb Date: Mon, 25 May 2026 18:20:30 +0900 Subject: [PATCH] =?UTF-8?q?feat(tarot-lab):=20config=20+=20Pydantic=20?= =?UTF-8?q?=EB=AA=A8=EB=8D=B8=205=EA=B0=9C=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tarot-lab/app/config.py | 16 ++++++++++++++ tarot-lab/app/models.py | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 tarot-lab/app/config.py create mode 100644 tarot-lab/app/models.py diff --git a/tarot-lab/app/config.py b/tarot-lab/app/config.py new file mode 100644 index 0000000..b3f3636 --- /dev/null +++ b/tarot-lab/app/config.py @@ -0,0 +1,16 @@ +"""tarot-lab 환경변수.""" +import os + +ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "") +TAROT_MODEL = os.getenv("TAROT_MODEL", "claude-sonnet-4-6") +TAROT_COST_INPUT_PER_M = float(os.getenv("TAROT_COST_INPUT_PER_M", "3.0")) +TAROT_COST_OUTPUT_PER_M = float(os.getenv("TAROT_COST_OUTPUT_PER_M", "15.0")) +TAROT_TIMEOUT_SEC = int(os.getenv("TAROT_TIMEOUT_SEC", "180")) + +TAROT_DATA_PATH = os.getenv("TAROT_DATA_PATH", "/app/data") +DB_PATH = os.path.join(TAROT_DATA_PATH, "tarot.db") + +CORS_ALLOW_ORIGINS = os.getenv( + "CORS_ALLOW_ORIGINS", + "http://localhost:3007,http://localhost:8080", +) diff --git a/tarot-lab/app/models.py b/tarot-lab/app/models.py new file mode 100644 index 0000000..7cea5b3 --- /dev/null +++ b/tarot-lab/app/models.py @@ -0,0 +1,47 @@ +"""Tarot Pydantic 모델 — agent-office models.py에서 추출.""" +from typing import List, Literal, Optional + +from pydantic import BaseModel, Field + + +class TarotCardDraw(BaseModel): + position: str + card_id: str + reversed: bool = False + + +class TarotInterpretRequest(BaseModel): + spread_type: Literal["one_card", "three_card"] + category: Optional[str] = None + question: Optional[str] = None + cards: List[TarotCardDraw] + cards_reference: str = Field(..., min_length=1) + context_meta: dict = Field(default_factory=dict) + + +class TarotInterpretResponse(BaseModel): + interpretation_json: dict + model: str + tokens_in: int + tokens_out: int + cost_usd: float + latency_ms: int + reroll_count: int = 0 + + +class TarotSaveRequest(BaseModel): + spread_type: Literal["one_card", "three_card"] + category: Optional[str] = None + question: Optional[str] = None + cards: List[TarotCardDraw] + interpretation_json: dict + model: str + tokens_in: int + tokens_out: int + cost_usd: float + confidence: Optional[str] = None + + +class TarotPatchRequest(BaseModel): + favorite: Optional[bool] = None + note: Optional[str] = None