Replaces #84 UI-noise removal plan with positive operational-alert contract. Five-axis stack lands together: (1) default model literal moved to current Opus-family ID, (2) Anthropic SDK error classifier mapping exceptions to quota/billing/auth/other, (3) api_error_kind plumbed through ai_repair_status summary + per-record retention, (4) Step 0 preflight ping gated under ai_fallback_enabled (default OFF preserved) with fail-fast on invalid model/key, (5) frontend formatter rewritten to surface only operational quota/billing/auth toasts (non-operational paths return null per feedback_auto_pipeline_first silent-pipeline policy). u1 - default model literal claude-opus-4-6-20250415 -> claude-opus-4-7 (src/config.py + tests/test_phase_z2_ai_fallback_config.py lock mirror) u2 - classify_operational_error type+status_code dispatch + Step 12 api_error_kind stamp on except path (src/phase_z2_ai_fallback/client.py + src/phase_z2_ai_fallback/step12.py + tests/phase_z2_ai_fallback/test_step12.py) u3 - _summarize_ai_repair_status aggregates api_error_kinds {quota,billing, auth,other}; error_records[i].api_error_kind retained per-record (src/phase_z2_pipeline.py + tests/test_imp47b_failure_surface.py) u4 - _run_step0_ai_preflight + Step0PreflightError; preflight only fires when ai_fallback_enabled=true; one-token ping; invalid key/model => setup failure before Step 1 (src/phase_z2_pipeline.py + tests/phase_z2/test_pipeline_step0_preflight.py NEW) u5 - AiRepairStatus.api_error_kinds? interface + formatAiRepairHumanReview Message rewritten: operational quota/billing/auth -> Korean copy verbatim from issue body (tie-break quota -> billing -> auth); validation/coverage_violated/unsupported_kind/generic-other/legacy payload -> null (Front/client/src/services/designAgentApi.ts + Front/client/tests/imp47b_human_review_toast.test.tsx) Guardrails respected: - feedback_demo_env_toggle_policy: default OFF preserved; preflight skipped when ai_fallback_enabled=false (test_preflight_skipped_when_disabled asserts anthropic.Anthropic() not called). - feedback_auto_pipeline_first: non-operational AI failures stay silent; only quota/billing/auth reach user toast. - feedback_ai_isolation_contract: AI remains fallback-only; no normal-path migration; MDX preserved. - project_imp46_carveout_caveat: cache_key/fingerprints fields untouched on every record; no overlap with #62 cache region. - feedback_no_hardcoding: zero MDX-sample-specific literals; classifier dispatch by SDK type, not by string parsing. - feedback_artifact_status_naming: operational toast scoped to alert axis, not overall PASS signal. Tests: - Targeted u1+u2+u3+u4: 63 passed - u5 vitest (Front/): 10/10 passed - tests/phase_z2_ai_fallback dir regression: 240 passed - tests/phase_z2 dir regression: 323 passed - IMP-92-adjacent (-k "imp47b or ai_fallback or preflight or step12 or step0"): 299 passed (808 deselected) - u1 baseline lock (test_client_mock.py): 8 passed Zero failures, zero regressions outside scope. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Design Agent 설정."""
|
|
|
|
anthropic_api_key: str = ""
|
|
kei_api_url: str = "http://localhost:8000"
|
|
log_level: str = "DEBUG"
|
|
|
|
# 슬라이드 크기
|
|
slide_width: int = 1280
|
|
slide_height: int = 720
|
|
|
|
# IMP-33 u1 — AI fallback policy. Fallback-path only; normal path AI=0.
|
|
# Defaults locked by Stage 2 plan; do NOT inline literals downstream.
|
|
ai_fallback_enabled: bool = False
|
|
ai_fallback_model: str = "claude-opus-4-7"
|
|
ai_fallback_timeout_s: float = 60.0
|
|
ai_fallback_max_retries: int = 3
|
|
ai_fallback_backoff_base_s: float = 1.0
|
|
ai_fallback_backoff_cap_s: float = 8.0
|
|
ai_fallback_backoff_jitter: float = 0.3
|
|
ai_fallback_budget_per_run: int = 10
|
|
ai_fallback_circuit_breaker_threshold: int = 5
|
|
|
|
# IMP-46 u5 — auto-cache flag. When True, `save_proposal` bypasses the
|
|
# `user_approved` gate only (`visual_check_passed` is never bypassed).
|
|
# Default OFF preserves the dual-gate contract; the CLI flag
|
|
# `--auto-cache` in `src/phase_z2_pipeline.py` mutates this setting at
|
|
# parse time. Downstream callers MUST source the flag from Settings,
|
|
# never inline literals.
|
|
ai_fallback_auto_cache: bool = False
|
|
|
|
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
|
|
|
|
|
|
settings = Settings()
|