feat(tarot-lab): config + Pydantic 모델 5개 추출

This commit is contained in:
2026-05-25 18:20:30 +09:00
parent 1775f7dd2d
commit 4073370e1b
2 changed files with 63 additions and 0 deletions

16
tarot-lab/app/config.py Normal file
View File

@@ -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",
)

47
tarot-lab/app/models.py Normal file
View File

@@ -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