Repository navigation
fix(drama): 只有声音没有主图的旁白可以正常提交 - #100
Merged
Merged
Conversation
角色卡绑了音色但从来没有主图(旁白、画外音)时,生成按钮一直被「角色「旁白」的主图未就绪或当前方式不支持参考图片」挡住:前后端都要求有音色的角色必须能在参考图里找到主图。 旁白本来就该只有声音、没有人像,改为: - 前端 `characterPrompt` 与后端 `characterPrompt`:无主图的角色不进【人物参考】,【人物音色对应】改写成「旁白(画外音):音色参考音频N。」;角色名后面不再拼「(图片N中的人物)」。 - 校验放宽到「真的没有主图」:`CharacterRefs.avatarPending` / `GenCharacter.AvatarPending` 区分「主图正在生成」,那种情况仍按主图未就绪拦住,不静默降级成画外音;有主图但没带进参考图的照旧报错。 - 后端 `addCharacter` 给无主图角色也带上音频素材,否则 refs 里没有音频、会被「声音未带入」拦住。 - 短剧 `segment-input` 判定参考音频时把角色卡绑定的声音算进去:只 @ 了旁白(没有参考图)的片段也会走全能参考,文生视频带不了音频时明确报错而不是静默丢掉。 共用 fixture 新增「只有声音没有主图的旁白按画外音带音色,不占参考图」,前后端同一条规则。
合并 master 时冲突解决丢了「},\n{」分隔,prompt-compose.json 变成非法
JSON:前端 prompt-compose-fixture.test.ts 直接抛 SyntaxError,后端
TestComposePromptMatchesFrontend 报 invalid character '"' after object
key:value pair,两边 CI 同时红。
按 master 的 12 个 case + 本分支的旁白 case 补齐,共 13 个。
characterPrompt 的认知复杂度从 20 以内被这次改动推到 28(golangci-lint gocognit 限额 20)。拆成 characterVisual / characterVoice / joinCharacterBlocks 三个小函数,输出逐字不变。 CI 用 --new-from-merge-base 只报新增行,函数签名行不是新增行,所以这处 超标在 CI 上被漏掉了,本地全量 lint 才看得见。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
用户能感受到的变化
问题
角色卡绑了音色但没有主图时,短剧片场的生成按钮一直灰着,悬停只提示「角色「旁白」的主图未就绪或当前方式不支持参考图片」。旁白本来就该只有声音、没有人像,这条校验把正常的旁白角色判成了配置错误。
规则来自
feat(character): 生成时绑定人物参考图与音色:前后端都要求「有音色的角色必须能在参考图里找到主图」。官方音色库上线后,给旁白选音色就会立刻触发,按钮从此点不动。改动
characterPrompt:无主图的角色不进【人物参考】,【人物音色对应】改写成「旁白(画外音):音色参考音频N。」,角色名后面不再拼「(图片N中的人物)」。CharacterRefs.avatarPending/GenCharacter.AvatarPending区分「主图正在生成」。那种情况仍按主图未就绪拦住,不静默降级成画外音;有主图但没带进参考图(被截断、方式不支持)的照旧报错。addCharacter:无主图角色也带上音频素材,否则 refs 里没有音频、会被「声音未带入」拦住。segment-input:判定参考音频时把角色卡绑定的声音算进去。只 @ 了旁白(没有参考图)的片段也会走全能参考;文生视频带不了音频时明确报错,而不是静默丢掉。测试
prompt-compose-fixture.test.ts与后端 fixture 测试读同一份,任何一边改规则都会失败。character-bindings(旁白只带音色 / 主图生成中仍拦住)、node-character(avatarPending只标主图生成中)、segment-input(只有旁白的片段走 omni、原「空角色节点」用例改用真的没音色的空卡)。TestAgentGenerator_CharacterVoice的「主图未就绪」改为「主图正在生成」,新增「只有声音没有主图的旁白可以提交」并核对参考图与音色编号。本地:
format:check1615 文件通过 ·tsc -b --noEmit干净 ·oxlint0 error ·bun test5209 通过 ·vite build通过 ·go vet ./...干净 ·go test ./...全通过。