feat(video-prompt): 台词带说话人照脚本原样 + 时长/比例只走参数不写正文

- _segment_script_text:有结构化对白(dialogue)就按「说话人:台词」原样放(说话人 id 用 script_entities
  解析成名字,如 室友/学生女主),回退扁平 narration;新增 with_dialogue/with_exposure 开关
- build_video_segment_prompt:视频脚本用带说话人台词、不带「商品露出」行(露出靠尾句统一要求);
  正文去掉 {时长}s · 9:16 竖屏(时长/比例本就 API 参数 duration/ratio 传,不再重复写进文字)
- 尾句改为:电商带货短视频,商品露出清晰,节奏有转化感。不要字幕,不要背景音乐,但是要有音效,逼真的音效
- 迁移 0014 同步刷新 DB 里 video_segment 模板(DB 覆盖代码默认),admin「视频」卡随之更新

真渲染 v3·场1 与产品对齐版一致;后端测试通过。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
seaislee1209
2026-06-23 18:05:27 +08:00
co-authored by Claude Opus 4.8
parent c2c2dfdc77
commit ee842da19c
2 changed files with 57 additions and 8 deletions
@@ -0,0 +1,29 @@
from django.db import migrations
# 视频提示词模板更新:时长/比例靠 API 参数传(不写正文)、台词带说话人(在 build 里)、
# 尾句改风格 + 音效/字幕要求。DB 模板覆盖代码默认,故这里同步刷新 video_segment 那行。
NEW = (
"{设定}{分镜}【脚本】{脚本}\n"
"电商带货短视频,商品露出清晰,节奏有转化感。不要字幕,不要背景音乐,但是要有音效,逼真的音效。"
)
OLD = "{设定}{分镜}【脚本】{脚本}\n{时长}s · 9:16 竖屏电商带货短视频,镜头稳定,商品露出清晰,节奏有转化感。"
def _set(apps, template):
PromptTemplate = apps.get_model("ai", "PromptTemplate")
PromptTemplate.objects.filter(key="video_segment").update(template=template)
def forwards(apps, schema_editor):
_set(apps, NEW)
def backwards(apps, schema_editor):
_set(apps, OLD)
class Migration(migrations.Migration):
dependencies = [("ai", "0013_seed_prompt_templates")]
operations = [migrations.RunPython(forwards, backwards)]