Media Engine Control Panel — 6탭 웹 대시보드 [백엔드] FastAPI (dashboard/backend/) - server.py: 포트 8080, CORS, React SPA 서빙 - api_overview.py: KPI 카드 + 파이프라인 상태 + 활동 로그 - api_content.py: 칸반 보드 + 승인/거부 + 수동 트리거 - api_analytics.py: 방문자 추이 + 플랫폼/코너별 성과 - api_novels.py: 소설 목록/생성/에피소드 관리 - api_settings.py: engine.json CRUD - api_connections.py: AI 서비스 연결 관리 + 키 저장 - api_tools.py: 기능별 AI 도구 선택 - api_cost.py: 구독 현황 + API 사용량 추적 - api_logs.py: 시스템 로그 필터/검색 [프론트엔드] React + Vite + Tailwind + Recharts (dashboard/frontend/) - Overview: KPI 카드 + 파이프라인 + 코너별 바차트 + 활동 로그 - Content: 4열 칸반 보드 + 상세 모달 + 승인/거부 - Analytics: LineChart 방문자 추이 + 플랫폼별 성과 - Novel: 소설 목록 + 에피소드 테이블 + 새 소설 생성 폼 - Settings: 5개 서브탭 (AI연결/도구선택/배포채널/품질/비용관리) - Logs: 필터/검색 시스템 로그 뷰어 [디자인] CNN 다크+골드 테마 - 배경 #0a0a0d + 액센트 #c8a84e - 모바일 반응형 (Tailscale 외부 접속 대응) [실행] - dashboard/start.bat 더블클릭 → http://localhost:8080 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""
|
|
dashboard/backend/api_settings.py
|
|
Settings 탭 API — engine.json 읽기/쓰기
|
|
"""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from fastapi import APIRouter, HTTPException
|
|
from pydantic import BaseModel
|
|
|
|
BASE_DIR = Path(__file__).parent.parent.parent
|
|
CONFIG_PATH = BASE_DIR / "config" / "engine.json"
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class SettingsUpdate(BaseModel):
|
|
data: dict
|
|
|
|
|
|
@router.get("/settings")
|
|
async def get_settings():
|
|
"""config/engine.json 반환"""
|
|
if not CONFIG_PATH.exists():
|
|
return {}
|
|
try:
|
|
return json.loads(CONFIG_PATH.read_text(encoding="utf-8"))
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=f"설정 파일 읽기 실패: {e}")
|
|
|
|
|
|
@router.put("/settings")
|
|
async def update_settings(req: SettingsUpdate):
|
|
"""config/engine.json 저장"""
|
|
try:
|
|
CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
CONFIG_PATH.write_text(
|
|
json.dumps(req.data, ensure_ascii=False, indent=2),
|
|
encoding="utf-8"
|
|
)
|
|
return {"success": True, "message": "설정 저장 완료"}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=f"설정 저장 실패: {e}")
|