feat(ssulbox): 썰박스 생성 파이프라인 통합 및 콘텐츠 목록 UNION

This commit is contained in:
skkim committed 2026-08-11 11:03:03 +09:00
1 parent 8096837b13
commit 666c3bf6d1
77 files changed
+15912 -349

No files matched your search

+85
View File
@@ -641,6 +641,90 @@ class SocialUploadSettings(BaseSettings):
model_config = _base_config
class SsulboxSettings(BaseSettings):
"""썰박스(병맛 역사 썰툰 쇼츠) 생성 설정.
GEMINI/NAVER/AZURE/JWT/KAKAO 등은 **castad 기존 설정을 재사용**하므로 여기 두지
않는다. 썰박스 고유 동작만 담는다.
⚠️ `GEMINI_API_KEY` 는 `APIKeySettings` 의 것을 쓰되, 기본값이 플레이스홀더
(`"your-gemeni-api-key"`)라 `bool()` 검사가 항상 True 다.
반드시 `app/ssulbox/constants.py` 의 `gemini_key()` 를 통해 읽을 것.
"""
SSULBOX_ENABLED: bool = Field(
default=True,
description="썰박스 기능 활성화. False 면 라우터 등록·스키마 보장·고아 스윕을 모두 건너뛴다",
)
# ============================================================
# 생성 엔진 경로
# ============================================================
SSULBOX_GENERATOR_DIR: str = Field(
default="generator",
description="생성 엔진 디렉토리 (프로젝트 루트 기준 상대 경로). app/ 패키지 밖에 둔다",
)
SSULBOX_OUTPUT_DIR: str = Field(
default="generator/output",
description="생성 산출물 디렉토리 (프로젝트 루트 기준 상대 경로)",
)
# ============================================================
# 잡 실행
# ============================================================
SSULBOX_MAX_CONCURRENT_JOBS: int = Field(
default=1,
description=(
"동시 실행 생성 잡 수. 영상 렌더가 API 프로세스와 CPU를 공유하므로 1을 권장. "
"높이면 요청 응답 지연이 커진다"
),
)
SSULBOX_JOB_TIMEOUT_SECONDS: int = Field(
default=900,
description=(
"생성 subprocess 최대 실행 시간(초). 초과 시 kill 후 환불 처리. "
"실측: scenes=4/seconds=20 이 75초. 기본값 scenes=9 는 씬 수에 "
"선형 비례하므로 3~5분대 예상 → 900초는 약 3배 여유. "
"프론트 폴링 한도(30분)보다 짧아야 사용자가 먼저 포기하는 일이 없다"
),
)
SSULBOX_DB_DELEGATE_TIMEOUT: int = Field(
default=60,
description=(
"워커 스레드가 앱 이벤트 루프에 DB 작업을 위임할 때의 대기 한도(초). "
"asyncmy 풀이 루프에 바인딩되므로 스레드에서 직접 쓸 수 없다"
),
)
# ============================================================
# 크레딧 · 저장소 · 폴링
# ============================================================
SSULBOX_CREDITS_PER_VIDEO: int = Field(
default=1,
description="생성 1건당 차감 크레딧 (요청 시점에 선차감, 실패 시 환불)",
)
SSULBOX_BLOB_PREFIX: str = Field(
default="ssulbox",
description="Azure Blob 경로 접두. castad 영상과 저장 경로를 분리한다",
)
SSULBOX_POLL_HINT_SECONDS: int = Field(
default=3,
description="클라이언트에 알려줄 권장 폴링 간격(초). castad waitForVideoComplete 와 동일",
)
model_config = _base_config
@property
def generator_path(self) -> Path:
"""생성 엔진 절대 경로"""
return PROJECT_DIR / self.SSULBOX_GENERATOR_DIR
@property
def output_path(self) -> Path:
"""생성 산출물 절대 경로"""
return PROJECT_DIR / self.SSULBOX_OUTPUT_DIR
prj_settings = ProjectSettings()
cors_settings = CORSSettings()
apikey_settings = APIKeySettings()
@@ -658,3 +742,4 @@ social_oauth_settings = SocialOAuthSettings()
meta_conversion_settings = MetaConversionSettings()
internal_settings = InternalSettings()
social_upload_settings = SocialUploadSettings()
ssulbox_settings = SsulboxSettings()