From 151269150402a7b7eff82c9f9443296e1cd355c1 Mon Sep 17 00:00:00 2001 From: dhlim Date: Thu, 26 Feb 2026 02:26:53 +0000 Subject: [PATCH 1/2] =?UTF-8?q?gpt=20timeout=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/social/api/routers/v1/seo.py | 2 +- app/utils/chatgpt_prompt.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/social/api/routers/v1/seo.py b/app/social/api/routers/v1/seo.py index af80407..f1fd213 100644 --- a/app/social/api/routers/v1/seo.py +++ b/app/social/api/routers/v1/seo.py @@ -95,7 +95,7 @@ async def make_youtube_seo_description( "language" : project.language, "target_keywords" : hashtags } - chatgpt = ChatgptService() + chatgpt = ChatgptService(timeout = 180) yt_seo_output = await chatgpt.generate_structured_output(yt_upload_prompt, yt_seo_input_data) result_dict = { "title" : yt_seo_output.title, diff --git a/app/utils/chatgpt_prompt.py b/app/utils/chatgpt_prompt.py index 4b9a950..8036456 100644 --- a/app/utils/chatgpt_prompt.py +++ b/app/utils/chatgpt_prompt.py @@ -43,6 +43,7 @@ class ChatgptService: text_format=output_format ) # Response 디버그 로깅 + logger.debug(f"[ChatgptService] attempt: {attempt}") logger.debug(f"[ChatgptService] Response ID: {response.id}") logger.debug(f"[ChatgptService] Response status: {response.status}") logger.debug(f"[ChatgptService] Response model: {response.model}") From ed616e4f66200976dc674c7ef01d950a2bd4c74b Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 26 Feb 2026 14:11:09 +0900 Subject: [PATCH 2/2] =?UTF-8?q?video/status=20render=20data=20=EB=B9=84?= =?UTF-8?q?=EB=94=94=EC=98=A4=20id=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/video/api/routers/v1/video.py | 6 +++++- app/video/schemas/video_schema.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/video/api/routers/v1/video.py b/app/video/api/routers/v1/video.py index 94e39ff..15a101c 100644 --- a/app/video/api/routers/v1/video.py +++ b/app/video/api/routers/v1/video.py @@ -549,7 +549,8 @@ async def get_video_status( "failed": "영상 생성에 실패했습니다.", } message = status_messages.get(status, f"상태: {status}") - + + video_id = None # succeeded 상태인 경우 백그라운드 태스크 실행 if status == "succeeded" and video_url: # creatomate_render_id로 Video 조회하여 task_id 가져오기 @@ -561,6 +562,8 @@ async def get_video_status( ) video = video_result.scalar_one_or_none() + video_id = video.id + if video and video.status != "completed": # 이미 완료된 경우 백그라운드 작업 중복 실행 방지 # 백그라운드 태스크로 MP4 다운로드 → Blob 업로드 → DB 업데이트 → 임시 파일 삭제 @@ -584,6 +587,7 @@ async def get_video_status( status=status, url=video_url, snapshot_url=result.get("snapshot_url"), + video_id = video_id if video_id else None ) logger.info( diff --git a/app/video/schemas/video_schema.py b/app/video/schemas/video_schema.py index 1b570be..27ecdd8 100644 --- a/app/video/schemas/video_schema.py +++ b/app/video/schemas/video_schema.py @@ -49,6 +49,7 @@ class VideoRenderData(BaseModel): status: Optional[str] = Field(None, description="렌더 상태") url: Optional[str] = Field(None, description="영상 URL") snapshot_url: Optional[str] = Field(None, description="스냅샷 URL") + video_id: Optional[int] = Field(None, description="Video id(DB)") class PollingVideoResponse(BaseModel):