번역오류 수정 및 CTA적용

This commit is contained in:
skkim committed 2026-07-21 13:56:40 +09:00
commit 788e76ef76
8 files changed
+216 -37

No files matched your search

+25 -12
View File
@@ -31,7 +31,7 @@ from app.home.api.routers.v1.home import _extract_region_from_address
from app.utils.address_parser import SIDO_CITIES, SIDO_SEARCH_ALIASES
from app.lyric.models import Lyric
from app.song.models import Song, SongTimestamp
from app.utils.creatomate import CreatomateService
from app.utils.creatomate import CreatomateService, LANGUAGE_FONT_MAP
from app.comment.models import Comment
from app.database.like_cache import (
@@ -192,6 +192,7 @@ async def generate_video(
brand_name = project.store_name
region = project.region
industry = project.industry
output_language = project.language or "Korean"
# MarketingIntel 조회
marketing_result = await session.execute(
@@ -382,14 +383,22 @@ async def generate_video(
modifications.update(subtitle_modifications)
# revert thumbnail scene
thumbnail_modifications = creatomate_service.make_thumbnail_modification(
# 썸네일 텍스트: 사전 자막 생성(LLM, 다국어) 결과에 thumb-* 슬롯이 포함되면
# 그대로 사용한다. 과거 파이프라인 산출물(subtitle에 thumb-* 없음)은
# 기존 팩트값 조립(한국어)으로 폴백.
thumbnail_fallback = creatomate_service.make_thumbnail_modification(
brand_name =brand_name,
region = region,
category_definition= category_definition,
target_keywords=target_keywords)
modifications.update(thumbnail_modifications)
target_keywords=target_keywords,
detail_region_info=store_address)
for slot_name, fallback_value in thumbnail_fallback.items():
if not modifications.get(slot_name):
modifications[slot_name] = fallback_value
logger.info(
f"[generate_video] thumbnail slot fallback(factual) 적용: {slot_name} - task_id: {task_id}"
)
# 6-3. elements 수정
new_elements = creatomate_service.modify_element(
@@ -414,12 +423,8 @@ async def generate_video(
for i, ts in enumerate(song_timestamp_list):
logger.debug(f"[generate_video] timestamp[{i}]: lyric_line={ts.lyric_line}, start_time={ts.start_time}, end_time={ts.end_time}")
match lyric_language:
case "English" :
lyric_font = "Noto Sans"
# lyric_font = "Pretendard" # 없어요
case _ :
lyric_font = "Noto Sans"
# 가사 자막 폰트: CJK/태국어는 글리프 지원 폰트로, 그 외는 Noto Sans
lyric_font = LANGUAGE_FONT_MAP.get(lyric_language, "Noto Sans")
# LYRIC AUTO 결정부
if (creatomate_settings.LYRIC_SUBTITLE):
@@ -439,6 +444,14 @@ async def generate_video(
)
final_template["source"]["elements"].append(caption)
# END - LYRIC AUTO 결정부
# 언어별 폰트 교체: 템플릿 기본 폰트는 한글·라틴 전용이라 CJK/태국어는
# 지원 폰트로 전체 텍스트(자막·키워드·썸네일·가사 캡션 포함)를 교체한다.
# 가사 캡션 append 이후에 실행해야 캡션까지 커버된다.
final_template = creatomate_service.apply_language_font(
final_template, output_language
)
# logger.debug(
# f"[generate_video] final_template: {json.dumps(final_template, indent=2, ensure_ascii=False)}"
# )
+13 -3
View File
@@ -857,6 +857,16 @@ async def get_image_tags_by_task_id(task_id: str) -> list[dict]:
# print(stmt.compile(dialect=mysql.dialect(), compile_kwargs={"literal_binds": True}))
rows = (await session.execute(stmt)).all()
# print("rows", rows)
# print(rows)
# print("image" , [{"image_url": row.img_url, "image_tag": row.img_tag} for row in rows])
return [{"image_url": row.img_url, "image_tag": row.img_tag} for row in rows]
# img_tag가 JSON 리터럴 null로 저장된 행(태깅 실패 잔재)은 SQL IS NOT NULL 필터를
# 통과하므로 파이썬 레벨에서 한 번 더 걸러낸다.
null_tag_urls = [row.img_url for row in rows if row.img_tag is None]
if null_tag_urls:
logger.warning(
f"[get_image_tags_by_task_id] img_tag가 null인 이미지 {len(null_tag_urls)}개 제외 "
f"- task_id: {task_id}, urls: {null_tag_urls}"
)
return [
{"image_url": row.img_url, "image_tag": row.img_tag}
for row in rows
if row.img_tag is not None
]