"""回归用例:喂给联合音视频模型(MiniMax H3)的 caption 里不能出现「会被念出来」的整句。 现场证据(项目 11《告诉你个小秘密第1期》v2 成片逐镜 ASR): 提示词开头那几条陈述整句 是这一镜的画面。是俊杰,高大,和蔼。 被模型当成旁白**原样念了出来**(shot-02 前 2.68s、shot-03 前 2.0s 的 「是这一镜的画面和石腰准和碍」就是它),台词本身反而正常。 把绑定改成定语写法「中的俊杰」后重新生成(task 541), ASR 只剩台词本体、开头完全静音,画面里两个角色的长相/服装仍然与定妆图一致。 所以这里锁两件事:① 默认写法不留任何「是X」整句; ② 台词、身份锚定、镜头语言一样都不能少(不能为了静音把信息删光)。 """ from __future__ import annotations import re from app.models import Character, Project, Scene, Shot from app.services import prompt as P ROLES = [{"index": 1, "owner_type": "frame", "owner_id": None, "name": "画面"}, {"index": 2, "owner_type": "human", "owner_id": None, "name": "俊杰"}, {"index": 3, "owner_type": "human", "owner_id": None, "name": "紫小慧"}, {"index": 4, "owner_type": "scene", "owner_id": None, "name": "场景"}] def _case(db): project = Project(name="自检-联合caption", aspect_ratio="9:16", resolution="720p", fps=24, style_guide="办公室轻松风格", default_provider="comfyui", target_duration=20) db.add(project) db.flush() male = Character(project_id=project.id, name="俊杰", gender="male", appearance="高大,和蔼") female = Character(project_id=project.id, name="紫小慧", gender="female", appearance="年轻东亚女生,精致淡妆") scene = Scene(project_id=project.id, name="办公室", prompt="现代简约的办公室,明亮整洁,有电脑工位") db.add_all([male, female, scene]) db.flush() shot = Shot(project_id=project.id, order_index=1, code="S01", title="俊杰解答", description="俊杰坐在工位上,从容自信地微笑着转头看向紫小慧", duration=8, shot_size="close_up", camera_angle="eye_level", camera_movement="static", mode="r2v", status="ready", dialogue="不要着急,恢复系统和数据一键就能完成。", speaker_character_id=male.id, ambience="办公室环境底噪") shot.characters = [male, female] shot.scenes = [scene] db.add(shot) db.flush() roles = [dict(ROLES[0]), dict(ROLES[1], owner_id=male.id), dict(ROLES[2], owner_id=female.id), dict(ROLES[3], owner_id=scene.id)] return project, shot, roles def test_joint_caption_leaves_no_speakable_binding_sentence(db): """默认(inline):整段没有任何「是X」陈述句,也不以标签开头。""" project, shot, roles = _case(db) text = P.compose_prompt(project, shot, db=db, joint_av=True, roles=roles, duration_seconds=8) assert not re.search(r"是", text), f"仍有会被念出来的绑定整句:{text}" # 每个标签后面都必须是「中的…」定语:定语不是句子,模型不会朗读它 assert re.findall(r"(?!中的)", text) == [], f"有标签没走定语写法:{text}" # 身份锚定一句没少,只是换成不会被朗读的定语 assert "中的俊杰" in text and "中的紫小慧" in text assert "中的画面" in text and "中的" in text # 台词是官方说话段落,不再是「{名}台词:「…」」这种能被朗读的说明句 assert "不要着急,恢复系统和数据一键就能完成。" in text, text assert text.endswith(""), f"台词必须是最后一段:{text}" assert "台词" not in text and ":" not in text, text # 特征短语与动作之间必须留分隔,否则「年轻东亚女生转头看向」会被当成新词 assert ",," not in text, text assert "转头看向中的紫小慧,年轻东亚女生" in text, text # 「和蔼」这类看不见的气质/妆造词不进联合提示词:定妆图已经锁死了人, # 气质文字模型既演不出来又最容易被当台词念出来(「轻熟纯欲气质」实测被念)。 assert "和蔼" not in text and "精致淡妆" not in text, text assert "中的俊杰,高大,坐在工位上" in text, text # 镜头语言照旧下发;时长/画幅不再写成文字——它们是 length/width/height 结构化入参, # 写成句子就会被念出来(v2 成片开头那句「时长约 8 秒画幅 9 比 16」) assert "近景" in text and "固定机位" in text, text assert "时长" not in text and "画幅" not in text and "秒" not in text, text # 没有参考音色时不能凭空写