영상 생성시 이미지 url 전송 -> task_id로 직접 검색으로 변경
This commit is contained in:
1 parent
c6d9edbb42
commit
95d90dcb50
2 files changed
+66
-112
No files matched your search
@@ -5,59 +5,9 @@ Video API Schemas
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Literal, Optional
|
||||
from typing import Any, Dict, Literal, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Request Schemas
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class GenerateVideoRequest(BaseModel):
|
||||
"""영상 생성 요청 스키마
|
||||
|
||||
Usage:
|
||||
POST /video/generate/{task_id}
|
||||
Request body for generating a video via Creatomate API.
|
||||
|
||||
Note:
|
||||
- music_url, duration, lyrics(song_prompt)는 task_id로 Song 테이블에서 자동 조회됩니다.
|
||||
- 같은 task_id로 여러 Song이 있을 경우 가장 최근 생성된 것을 사용합니다.
|
||||
|
||||
Example Request:
|
||||
{
|
||||
"orientation": "vertical",
|
||||
"image_urls": ["https://...", "https://..."]
|
||||
}
|
||||
"""
|
||||
|
||||
model_config = {
|
||||
"json_schema_extra": {
|
||||
"example": {
|
||||
"orientation": "vertical",
|
||||
"image_urls": [
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_189/1715688030436xT14o_JPEG/1.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_48/1715688030574wTtQd_JPEG/2.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_92/17156880307484bvpH_JPEG/3.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_7/1715688031000y8Y5q_JPEG/4.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_259/17156880311809wCnY_JPEG/5.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_64/1715688031601oGNsV_JPEG/6.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_175/1715688031657oXc7l_JPEG/7.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_192/1715688031798MbFDj_JPEG/8.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_205/17156880318681JLwX_JPEG/9.jpg",
|
||||
"https://naverbooking-phinf.pstatic.net/20240514_142/1715688031946hhxHz_JPEG/10.jpg",
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
orientation: Literal["horizontal", "vertical"] = Field(
|
||||
default="vertical",
|
||||
description="영상 방향 (horizontal: 가로형, vertical: 세로형, 기본값: vertical)",
|
||||
)
|
||||
image_urls: List[str] = Field(..., description="영상에 사용할 이미지 URL 목록")
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -69,19 +19,22 @@ class GenerateVideoResponse(BaseModel):
|
||||
"""영상 생성 응답 스키마
|
||||
|
||||
Usage:
|
||||
POST /video/generate/{task_id}
|
||||
GET /video/generate/{task_id}
|
||||
Returns the task IDs for tracking video generation.
|
||||
|
||||
Example Response (Success):
|
||||
{
|
||||
"success": true,
|
||||
"task_id": "019123ab-cdef-7890-abcd-ef1234567890",
|
||||
"creatomate_render_id": "render-id-123",
|
||||
"message": "영상 생성 요청이 접수되었습니다.",
|
||||
"error_message": null
|
||||
}
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"success": True,
|
||||
"task_id": "0694b716-dbff-7219-8000-d08cb5fce431",
|
||||
"creatomate_render_id": "render-id-123456",
|
||||
"message": "영상 생성 요청이 접수되었습니다. creatomate_render_id로 상태를 조회하세요.",
|
||||
"error_message": None,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
success: bool = Field(..., description="요청 성공 여부")
|
||||
task_id: Optional[str] = Field(None, description="내부 작업 ID (Project task_id)")
|
||||
creatomate_render_id: Optional[str] = Field(None, description="Creatomate 렌더 ID")
|
||||
|
||||
Reference in new issue
Block a user