Skip to content

PRINTFILM: AI short-video marketing and AI short-drama creation platform

fix: 漫剧暂关音色绑定,口播交给 Seedance 自行发挥

yid90bac2bee5f
diff --git a/backend/app/services/ark.py b/backend/app/services/ark.py
index 8dc303b..d98e067 100644
--- a/backend/app/services/ark.py
+++ b/backend/app/services/ark.py
@@ -12,7 +12,7 @@ import time
import uuid
from dataclasses import dataclass
from pathlib import Path
-from typing import Any
+from typing import Any, NoReturn
from urllib.parse import urlparse
import httpx
@@ -28,6 +28,7 @@ from app.services.logical_model_router import (
from app.services.tokenfree_audio import (
TOKENFREE_DEFAULT_TTS_MODEL,
resolve_tokenfree_tts_model,
+ tokenfree_speech_honors_speaker,
tokenfree_speech_voice,
uses_tokenfree_audio,
)
@@ -65,6 +66,35 @@ from app.services import seedance_segments as segplan
logger = logging.getLogger(__name__)
+# TokenFree /v1/responses 同步等图,常见 2–8 分钟;连接短、读体长
+IMAGE_GEN_READ_SEC = 600.0
+# 创建视频任务应返回 task_id;TokenFree 拉参考图时可能拖到一两分钟
+VIDEO_CREATE_READ_SEC = 180.0
+# 轮询/单次查询只要状态 JSON
+VIDEO_POLL_READ_SEC = 60.0
+VIDEO_FETCH_READ_SEC = 30.0
+
+
+def _upstream_timeout(read_sec: float, *, connect: float = 30.0) -> httpx.Timeout:
+ """上游 HTTP 超时:建连短、等结果长,避免 ReadTimeout 被当成连不上。"""
+ return httpx.Timeout(connect=connect, read=float(read_sec), write=60.0, pool=30.0)
+
+
+def reraise_upstream_timeout(exc: BaseException, *, kind: str, read_sec: float) -> NoReturn:
+ """把 httpx 超时翻成可读 RuntimeError;ReadTimeout 表示已连通但等结果超时。"""
+ if isinstance(exc, httpx.ReadTimeout):
+ raise RuntimeError(
+ f"{kind}等待上游超时(ReadTimeout):已连通 TokenFree,但 {read_sec:.0f} 秒内未返回结果,请稍后重试"
+ ) from exc
+ if isinstance(exc, httpx.WriteTimeout):
+ raise RuntimeError(
+ f"{kind}发送请求超时(WriteTimeout):已连通 TokenFree,但 {read_sec:.0f} 秒内未能发完请求,请稍后重试"
+ ) from exc
+ name = type(exc).__name__
+ raise RuntimeError(
+ f"{kind}无法连接上游({name}):请检查网络、代理或 TokenFree 是否可达"
+ ) from exc
+
def _raise_seedream_http_error(
status_code: int,
@@ -847,30 +877,33 @@ class ArkGateway:
if refs:
body["image"] = refs if len(refs) > 1 else refs[0]
- async with httpx.AsyncClient(timeout=180.0) as client:
- async def _post():
- # 单次上游 POST,限流重试由外层包住
- return await client.post(
- self._route_url(path, route),
- headers=self._route_headers(route),
- json=body,
- )
+ try:
+ async with httpx.AsyncClient(timeout=_upstream_timeout(IMAGE_GEN_READ_SEC)) as client:
+ async def _post():
+ # 单次上游 POST,限流重试由外层包住
+ return await client.post(
+ self._route_url(path, route),
+ headers=self._route_headers(route),
+ json=body,
+ )
- if on_tokenfree:
- async with tokenfree_image_slot():
- resp = await post_until_not_rate_limited(_post)
- else:
- resp = await _post()
- if resp.status_code >= 400 or is_tokenfree_retryable_image_error(
- status_code=resp.status_code, body=resp.text
- ):
- _raise_seedream_http_error(
- resp.status_code,
- resp.text,
- model=chosen,
- tokenfree=on_tokenfree,
- )
- data = resp.json()
+ if on_tokenfree:
+ async with tokenfree_image_slot():
+ resp = await post_until_not_rate_limited(_post)
+ else:
+ resp = await _post()
+ if resp.status_code >= 400 or is_tokenfree_retryable_image_error(
+ status_code=resp.status_code, body=resp.text
+ ):
+ _raise_seedream_http_error(
+ resp.status_code,
+ resp.text,
+ model=chosen,
+ tokenfree=on_tokenfree,
+ )
+ data = resp.json()
+ except httpx.TimeoutException as exc:
+ reraise_upstream_timeout(exc, kind="生图", read_sec=IMAGE_GEN_READ_SEC)
usage_parsed = parse_usage_dict(data)
raw_usage = data.get("usage") if isinstance(data.get("usage"), dict) else None
@@ -1142,65 +1175,68 @@ class ArkGateway:
body["generate_audio"],
)
- async with httpx.AsyncClient(timeout=60.0) as client:
- resp = await client.post(
- self._route_url("/contents/generations/tasks", route),
- headers=self._route_headers(route),
- json=self._video_json(body, route),
- )
- if resp.status_code >= 400 and prompt_as_json:
- # Fallback: plain text prompt
- body["content"][0]["text"] = plain
+ try:
+ async with httpx.AsyncClient(timeout=_upstream_timeout(VIDEO_CREATE_READ_SEC)) as client:
resp = await client.post(
self._route_url("/contents/generations/tasks", route),
headers=self._route_headers(route),
json=self._video_json(body, route),
)
- # 文案策略:在 ratio/adaptive 结构回退前,对当前意图 body 追加 CG 重试
- if resp.status_code >= 400:
- raw_err = resp.text or ""
- if self._is_seedance_input_privacy_error(raw_err):
- raise RuntimeError(_format_seedance_create_error(resp.status_code, raw_err))
- if self._is_seedance_text_policy_error(raw_err):
- cg_content = self._seedance_content_with_cg_style(body.get("content"))
- if cg_content is not None:
- logger.warning("Seedance i2v text policy hit; retrying with CG style")
- body = {**body, "content": cg_content}
+ if resp.status_code >= 400 and prompt_as_json:
+ # Fallback: plain text prompt
+ body["content"][0]["text"] = plain
+ resp = await client.post(
+ self._route_url("/contents/generations/tasks", route),
+ headers=self._route_headers(route),
+ json=self._video_json(body, route),
+ )
+ # 文案策略:在 ratio/adaptive 结构回退前,对当前意图 body 追加 CG 重试
+ if resp.status_code >= 400:
+ raw_err = resp.text or ""
+ if self._is_seedance_input_privacy_error(raw_err):
+ raise RuntimeError(_format_seedance_create_error(resp.status_code, raw_err))
+ if self._is_seedance_text_policy_error(raw_err):
+ cg_content = self._seedance_content_with_cg_style(body.get("content"))
+ if cg_content is not None:
+ logger.warning("Seedance i2v text policy hit; retrying with CG style")
+ body = {**body, "content": cg_content}
+ resp = await client.post(
+ self._route_url("/contents/generations/tasks", route),
+ headers=self._route_headers(route),
+ json=self._video_json(body, route),
+ )
+ if resp.status_code >= 400:
+ raise RuntimeError(
+ _format_seedance_create_error(resp.status_code, resp.text)
+ )
+ if resp.status_code >= 400:
+ err_text = resp.text or ""
+ # 仅「误用 first_frame + ratio」时去掉 ratio;有目标画幅时不得回落到 adaptive 横屏
+ if (
+ not target_ratio
+ and "ratio" in err_text.lower()
+ and "ratio" in body
+ ):
+ body.pop("ratio", None)
resp = await client.post(
self._route_url("/contents/generations/tasks", route),
headers=self._route_headers(route),
json=self._video_json(body, route),
)
- if resp.status_code >= 400:
- raise RuntimeError(
- _format_seedance_create_error(resp.status_code, resp.text)
- )
- if resp.status_code >= 400:
- err_text = resp.text or ""
- # 仅「误用 first_frame + ratio」时去掉 ratio;有目标画幅时不得回落到 adaptive 横屏
- if (
- not target_ratio
- and "ratio" in err_text.lower()
- and "ratio" in body
- ):
- body.pop("ratio", None)
+ if resp.status_code >= 400 and not target_ratio:
+ # 无目标画幅时的兼容回退;有竖屏目标时禁止 adaptive,避免再次出横屏
+ body["content"][1].pop("role", None)
+ body["ratio"] = "adaptive"
resp = await client.post(
self._route_url("/contents/generations/tasks", route),
headers=self._route_headers(route),
json=self._video_json(body, route),
)
- if resp.status_code >= 400 and not target_ratio:
- # 无目标画幅时的兼容回退;有竖屏目标时禁止 adaptive,避免再次出横屏
- body["content"][1].pop("role", None)
- body["ratio"] = "adaptive"
- resp = await client.post(
- self._route_url("/contents/generations/tasks", route),
- headers=self._route_headers(route),
- json=self._video_json(body, route),
- )
- if resp.status_code >= 400:
- raise RuntimeError(_format_seedance_create_error(resp.status_code, resp.text))
- data = resp.json()
+ if resp.status_code >= 400:
+ raise RuntimeError(_format_seedance_create_error(resp.status_code, resp.text))
+ data = resp.json()
+ except httpx.TimeoutException as exc:
+ reraise_upstream_timeout(exc, kind="生视频", read_sec=VIDEO_CREATE_READ_SEC)
task_id = extract_video_task_id(data)
if not task_id:
@@ -1267,46 +1303,49 @@ class ArkGateway:
len(payload.get("content") or []),
)
- async with httpx.AsyncClient(timeout=60.0) as client:
- resp = await client.post(
- self._route_url("/contents/generations/tasks", route),
- headers=self._route_headers(route),
- json=self._video_json(payload, route),
- )
- if resp.status_code >= 400:
- raw_err = resp.text or ""
- # 参考图真人:改文案无效
- if self._is_seedance_input_privacy_error(raw_err):
- raise RuntimeError(
- _format_seedance_create_error(
- resp.status_code,
- raw_err,
- content_labels=content_labels,
- )
- )
- cg_content = None
- if self._is_seedance_text_policy_error(raw_err):
- cg_content = self._seedance_content_with_cg_style(payload.get("content"))
- if cg_content is not None:
- logger.warning(
- "Seedance text policy hit project=%s; retrying with CG style",
- project_id,
- )
- payload = {**payload, "content": cg_content}
- resp = await client.post(
- self._route_url("/contents/generations/tasks", route),
- headers=self._route_headers(route),
- json=self._video_json(payload, route),
- )
+ try:
+ async with httpx.AsyncClient(timeout=_upstream_timeout(VIDEO_CREATE_READ_SEC)) as client:
+ resp = await client.post(
+ self._route_url("/contents/generations/tasks", route),
+ headers=self._route_headers(route),
+ json=self._video_json(payload, route),
+ )
if resp.status_code >= 400:
- raise RuntimeError(
- _format_seedance_create_error(
- resp.status_code,
- resp.text,
- content_labels=content_labels,
+ raw_err = resp.text or ""
+ # 参考图真人:改文案无效
+ if self._is_seedance_input_privacy_error(raw_err):
+ raise RuntimeError(
+ _format_seedance_create_error(
+ resp.status_code,
+ raw_err,
+ content_labels=content_labels,
+ )
)
- )
- data = resp.json()
+ cg_content = None
+ if self._is_seedance_text_policy_error(raw_err):
+ cg_content = self._seedance_content_with_cg_style(payload.get("content"))
+ if cg_content is not None:
+ logger.warning(
+ "Seedance text policy hit project=%s; retrying with CG style",
+ project_id,
+ )
+ payload = {**payload, "content": cg_content}
+ resp = await client.post(
+ self._route_url("/contents/generations/tasks", route),
+ headers=self._route_headers(route),
+ json=self._video_json(payload, route),
+ )
+ if resp.status_code >= 400:
+ raise RuntimeError(
+ _format_seedance_create_error(
+ resp.status_code,
+ resp.text,
+ content_labels=content_labels,
+ )
+ )
+ data = resp.json()
+ except httpx.TimeoutException as exc:
+ reraise_upstream_timeout(exc, kind="生视频", read_sec=VIDEO_CREATE_READ_SEC)
task_id = extract_video_task_id(data)
if not task_id:
@@ -1415,7 +1454,7 @@ class ArkGateway:
)
deadline = time.monotonic() + self.settings.ark_video_poll_timeout
- async with httpx.AsyncClient(timeout=60.0) as client:
+ async with httpx.AsyncClient(timeout=_upstream_timeout(VIDEO_POLL_READ_SEC, connect=15.0)) as client:
while time.monotonic() < deadline:
try:
resp = await client.get(
@@ -1463,7 +1502,7 @@ class ArkGateway:
last_frame_url=f"/static/mock/last_{task_id[-8:]}.jpg",
)
try:
- async with httpx.AsyncClient(timeout=30.0) as client:
+ async with httpx.AsyncClient(timeout=_upstream_timeout(VIDEO_FETCH_READ_SEC, connect=15.0)) as client:
resp = await client.get(
self._url(f"/contents/generations/tasks/{task_id}"),
headers=self._headers(),
@@ -1689,7 +1728,7 @@ class ArkGateway:
duration_hint: float = 4.0,
emotion_hint: str | None = None,
) -> str:
- """整片/单镜配音:豆包 openspeech → TokenFree speech → edge-tts;失败则抛错,不写静音。"""
+ """整片/单镜配音:豆包 openspeech →(qwen 能认的音色才走 TokenFree)→ edge-tts;失败则抛错,不写静音。"""
voice_map = {
"narrator_calm": "zh_female_cancan_uranus_bigtts",
"warm_storyteller": "zh_female_tianmeixiaoyuan_uranus_bigtts",
@@ -1727,7 +1766,7 @@ class ArkGateway:
audio_model = self._resolved_audio_model()
on_tokenfree = uses_tokenfree_audio(base_url=self.settings.ark_base_url or "")
- # 豆包 openspeech:标准 speaker 优先于 TokenFree,避免 /audio/speech 忽略音色 id
+ # 豆包 openspeech:标准 speaker 优先,避免 /audio/speech 忽略音色 id
if self._openspeech_configured():
try:
ok = await self._tts_openspeech(clean, speaker, dest, emotion_hint=emotion_hint)
@@ -1739,8 +1778,8 @@ class ArkGateway:
except Exception as exc: # noqa: BLE001
logger.warning("openspeech TTS failed: %s", exc)
- # TokenFree:走 New API /audio/speech(与 MODEL_AUDIO / 默认音频逻辑模型一致)
- if on_tokenfree:
+ # TokenFree qwen-tts 只认 Ethan/Cherry 等;豆包 zh_* 会全员男=Ethan,先跳过
+ if on_tokenfree and tokenfree_speech_honors_speaker(speaker):
try:
ok = await self._tts_openai_speech(clean, speaker, dest, model=audio_model)
if ok:
@@ -1756,16 +1795,32 @@ class ArkGateway:
except Exception as exc: # noqa: BLE001
logger.warning("tokenfree speech failed: %s", exc)
- # edge-tts 兜底:TokenFree 常无 seed-tts 渠道,豆包未授权时必须仍能出声
+ # edge-tts:按 speaker 映射不同 neural,豆包未授权时仍能分出角色声线
try:
await self._tts_edge(clean, dest, voice_hint=speaker)
url = await _accept_if_audible("edge-tts")
if url:
- logger.info("TTS edge-tts ok shot=%s bytes=%s", shot_no, dest.stat().st_size)
+ logger.info("TTS edge-tts ok shot=%s speaker=%s bytes=%s", shot_no, speaker, dest.stat().st_size)
return url
except Exception as exc: # noqa: BLE001
logger.warning("edge-tts failed: %s", exc)
+ # qwen 压声线也比完全没声音好:edge 失败后再用 TokenFree
+ if on_tokenfree and not tokenfree_speech_honors_speaker(speaker):
+ try:
+ ok = await self._tts_openai_speech(clean, speaker, dest, model=audio_model)
+ if ok:
+ url = await _accept_if_audible("tokenfree-speech-fallback")
+ if url:
+ logger.info(
+ "TTS tokenfree fallback ok shot=%s model=%s",
+ shot_no,
+ audio_model,
+ )
+ return url
+ except Exception as exc: # noqa: BLE001
+ logger.warning("tokenfree speech fallback failed: %s", exc)
+
# 非 TokenFree 时再试 /audio/speech(方舟等)
if not on_tokenfree:
try:
diff --git a/backend/app/services/drama/build_seedance_generate_body.py b/backend/app/services/drama/build_seedance_generate_body.py
index d2fd845..5a1373d 100644
--- a/backend/app/services/drama/build_seedance_generate_body.py
+++ b/backend/app/services/drama/build_seedance_generate_body.py
@@ -37,6 +37,9 @@ SEEDANCE_VISUAL_STYLE_SECTION_INTRO = (
"【强制约束:视频画面风格】全片画面必须严格遵循以下风格描述,"
"严禁偏离、弱化或混用其他画风与镜头美学:"
)
+# 音色难控:暂不提交 reference_audio、不写音色约束;口播由 Seedance generate_audio 自发挥。
+# 恢复绑定/提交时改回 True。
+SEEDANCE_ATTACH_REFERENCE_AUDIO = False
SEEDANCE_CHARACTER_VOICE_SECTION_HEADER = (
"【强制约束:角色音色】以下角色说话的音色、语气、节奏与发声质感必须与对应参考音频严格一致,"
"语速自然偏慢、吐字清晰,严禁加速赶词、替换、混用其他声线或自行改写:"
@@ -303,7 +306,8 @@ def build_seedance_reference_catalog(
seen_image_asset_ids.add(asset_id)
catalog.images.append(SeedanceReferenceFile(asset_id=asset_id, url=image_url))
- if asset.get("type") in {"character", "narration"}:
+ # 已绑定的试听暂不挂进 content[],避免 reference_audio 抢模型口播
+ if SEEDANCE_ATTACH_REFERENCE_AUDIO and asset.get("type") in {"character", "narration"}:
if not _should_attach_reference_audio(
asset,
filter_audio=filter_audio,
@@ -542,21 +546,27 @@ def build_seedance_prompt_text(
burn_subtitles=burn_subtitles,
character_intro=character_intro,
),
- build_reference_index_section(
- reference,
- "character",
- resolved_catalog.audio_index_by_asset_id,
- SEEDANCE_CHARACTER_VOICE_SECTION_HEADER,
- "参考音频",
- resolve_character_prompt_name,
- ),
- build_reference_index_section(
- reference,
- "narration",
- resolved_catalog.audio_index_by_asset_id,
- SEEDANCE_NARRATION_VOICE_SECTION_HEADER,
- "参考音频",
- resolve_narration_prompt_name,
+ *(
+ [
+ build_reference_index_section(
+ reference,
+ "character",
+ resolved_catalog.audio_index_by_asset_id,
+ SEEDANCE_CHARACTER_VOICE_SECTION_HEADER,
+ "参考音频",
+ resolve_character_prompt_name,
+ ),
+ build_reference_index_section(
+ reference,
+ "narration",
+ resolved_catalog.audio_index_by_asset_id,
+ SEEDANCE_NARRATION_VOICE_SECTION_HEADER,
+ "参考音频",
+ resolve_narration_prompt_name,
+ ),
+ ]
+ if SEEDANCE_ATTACH_REFERENCE_AUDIO
+ else []
),
build_reference_index_section(
reference,
diff --git a/backend/app/services/drama/generation.py b/backend/app/services/drama/generation.py
index 2ca7c4c..0d160b8 100644
--- a/backend/app/services/drama/generation.py
+++ b/backend/app/services/drama/generation.py
@@ -26,6 +26,7 @@ from app.services.drama.output_settings import (
from app.services.billing import record_line
from app.services.drama.build_seedance_generate_body import (
ASSET_MENTION_TOKEN_PATTERN,
+ SEEDANCE_ATTACH_REFERENCE_AUDIO,
build_seedance_generate_body,
build_seedance_reference_catalog,
describe_seedance_content_slots,
@@ -1425,6 +1426,8 @@ def build_fragment_ref_payloads(
ref_assets: list[DramaAsset],
) -> list[dict[str, Any]]:
ref_payloads = [drama_asset_to_payload(a) for a in ref_assets]
+ if not SEEDANCE_ATTACH_REFERENCE_AUDIO:
+ return ref_payloads
narrator_voice: Any = (project.params or {}).get("narrationVoiceAudio")
if isinstance(narrator_voice, dict):
narration_url = str(
@@ -1535,14 +1538,15 @@ async def prepare_fragment_video_for_submit(
ref_assets=ref_assets,
)
ref_assets = await ensure_reference_assets_public_urls(db, ref_assets)
- # 多参考视频需要音色音频
- ref_assets = await ensure_fragment_reference_audios(
- db,
- user,
- project,
- fragment,
- ref_assets,
- )
+ # 音色难控:暂不合成/补齐 reference_audio
+ if SEEDANCE_ATTACH_REFERENCE_AUDIO:
+ ref_assets = await ensure_fragment_reference_audios(
+ db,
+ user,
+ project,
+ fragment,
+ ref_assets,
+ )
ref_payloads = build_fragment_ref_payloads(project, ref_assets)
style_id = str((project.params or {}).get("image_style_id") or "").strip() or None
catalog = build_seedance_reference_catalog(ref_payloads)
diff --git a/backend/app/services/exc_format.py b/backend/app/services/exc_format.py
index b3fae6f..71b59eb 100644
--- a/backend/app/services/exc_format.py
+++ b/backend/app/services/exc_format.py
@@ -2,13 +2,15 @@
from __future__ import annotations
-# httpx / 网络类异常名(str(exc) 经常为空)
-_NETWORK_EXC_NAMES = frozenset(
+# 已建连、等响应超时(不是连不上)
+_READ_TIMEOUT_EXC_NAMES = frozenset({"ReadTimeout"})
+# 已建连、发请求体超时
+_WRITE_TIMEOUT_EXC_NAMES = frozenset({"WriteTimeout"})
+# 建连失败 / 代理不可达(含未细分的 TimeoutException)
+_CONNECT_EXC_NAMES = frozenset(
{
"ConnectError",
"ConnectTimeout",
- "ReadTimeout",
- "WriteTimeout",
"PoolTimeout",
"TimeoutException",
"NetworkError",
@@ -26,7 +28,13 @@ def format_exception_message(
"""生成带类型名的错误文案;ConnectError 等空 message 时补上可读说明。"""
name = type(exc).__name__
detail = str(exc).strip()
- if name in _NETWORK_EXC_NAMES:
+ if name in _READ_TIMEOUT_EXC_NAMES:
+ tip = detail or "上游已连通但响应超时(图片/视频生成可能超过等待上限)"
+ return f"网络错误({name}):{tip}"[:limit]
+ if name in _WRITE_TIMEOUT_EXC_NAMES:
+ tip = detail or "上游已连通但发送请求超时"
+ return f"网络错误({name}):{tip}"[:limit]
+ if name in _CONNECT_EXC_NAMES:
tip = detail or "无法连接上游服务(请检查网络、代理或 TokenFree 是否可达)"
return f"网络错误({name}):{tip}"[:limit]
if not detail:
diff --git a/backend/app/services/tokenfree_audio.py b/backend/app/services/tokenfree_audio.py
index 8f94dca..d5891d2 100644
--- a/backend/app/services/tokenfree_audio.py
+++ b/backend/app/services/tokenfree_audio.py
@@ -31,12 +31,23 @@ def resolve_tokenfree_tts_model(model: str | None) -> str:
return mid
+# qwen-tts 实际认的音色名;豆包 zh_* / S_ 不在此列
+_TOKENFREE_NATIVE_VOICES = frozenset({"Cherry", "Serena", "Ethan", "Chelsie", "alloy"})
+_TOKENFREE_NATIVE_VOICES_FOLD = {v.casefold(): v for v in _TOKENFREE_NATIVE_VOICES}
+
+
+def tokenfree_speech_honors_speaker(speaker: str) -> bool:
+ """qwen-tts 只接受少数英文音色;豆包 id 会被压成 Ethan/Cherry。"""
+ return (speaker or "").strip().casefold() in _TOKENFREE_NATIVE_VOICES_FOLD
+
+
def tokenfree_speech_voice(speaker: str) -> str:
"""豆包 speaker id → Qwen/OpenAI 兼容音色。"""
raw = (speaker or "").strip()
+ native = _TOKENFREE_NATIVE_VOICES_FOLD.get(raw.casefold())
+ if native:
+ return native
low = raw.lower()
if low.startswith("zh_male") or "_male_" in low:
return "Ethan"
- if raw in {"Cherry", "Serena", "Ethan", "Chelsie", "alloy"}:
- return raw
return "Cherry"
diff --git a/backend/app/services/voices.py b/backend/app/services/voices.py
index d79a3c7..dd1d930 100644
--- a/backend/app/services/voices.py
+++ b/backend/app/services/voices.py
@@ -74,27 +74,39 @@ DRAMA_SPEAKER_RULES: list[dict[str, Any]] = [
{
"speaker": "zh_male_baqiqingshu_uranus_bigtts",
"gender": "male",
- "keywords": ("老", "翁", "族老", "长者", "首领", "青叔", "大叔", "沉稳", "威严", "苍", "应龙"),
+ "keywords": (
+ "老", "翁", "族老", "长者", "首领", "青叔", "大叔", "威严", "苍", "应龙",
+ "爷爷", "祖父", "暮年", "苍老",
+ ),
},
{
"speaker": "zh_male_m191_uranus_bigtts",
"gender": "male",
- "keywords": ("领袖", "帝王", "君主", "大王", "治水", "禹", "庄重", "浑厚", "史诗", "统帅"),
+ "keywords": (
+ "领袖", "帝王", "君主", "大王", "治水", "禹", "庄重", "浑厚", "史诗", "统帅",
+ "低沉", "恢弘", "成年男", "管风琴", "悲悯", "厚重",
+ ),
},
{
"speaker": "zh_male_ruyayichen_uranus_bigtts",
"gender": "male",
- "keywords": ("儒雅", "书生", "谋士", "伯益", "文士", "智", "温和", "清朗", "参谋"),
+ "keywords": (
+ "儒雅", "书生", "谋士", "伯益", "文士", "温和", "清朗", "参谋",
+ "克制", "颗粒", "偏冷",
+ ),
},
{
"speaker": "zh_male_shaonianzixin_uranus_bigtts",
"gender": "male",
- "keywords": ("少年", "青年", "青壮", "小伙", "活力", "清亮", "少年音", "梓辛"),
+ "keywords": ("少年", "少年音", "清亮", "梓辛", "稚", "青春期", "青壮"),
},
{
"speaker": "zh_male_taocheng_uranus_bigtts",
"gender": "male",
- "keywords": ("年轻", "小哥", "明快", "阳光", "清爽"),
+ "keywords": (
+ "年轻", "青年", "小哥", "明快", "阳光", "清爽", "童声", "男孩", "儿童",
+ "圆润", "憨厚", "小伙",
+ ),
},
{
"speaker": "zh_female_vv_uranus_bigtts",
@@ -123,9 +135,26 @@ DRAMA_SPEAKER_RULES: list[dict[str, Any]] = [
},
]
-MALE_HINTS = ("男", "少年", "青年男", "老年男", "公子", "王爷", "少年音", "大叔", "青壮", "将", "伯", "公")
+MALE_HINTS = (
+ "男", "少年", "青年男", "老年男", "公子", "王爷", "少爷", "少年音", "大叔", "青壮",
+ "将", "伯", "公", "爷爷", "男孩",
+)
FEMALE_HINTS = ("女", "少女", "女声", "御姐", "小姐", "娘娘", "萝莉", "姑娘", "妇人", "村妇")
+# edge-tts 确认可用的男声仅 Yunxi/Yunjian/Yunyang(Yunxia 实为女童,不给男角色)
+EDGE_TTS_BY_SPEAKER: dict[str, str] = {
+ "zh_male_shaonianzixin_uranus_bigtts": "zh-CN-YunxiNeural",
+ "zh_male_taocheng_uranus_bigtts": "zh-CN-YunxiNeural",
+ "zh_male_m191_uranus_bigtts": "zh-CN-YunjianNeural",
+ "zh_male_baqiqingshu_uranus_bigtts": "zh-CN-YunyangNeural",
+ "zh_male_ruyayichen_uranus_bigtts": "zh-CN-YunjianNeural",
+ "zh_female_cancan_uranus_bigtts": "zh-CN-XiaoxiaoNeural",
+ "zh_female_tianmeixiaoyuan_uranus_bigtts": "zh-CN-XiaoyiNeural",
+ "zh_female_shuangkuaisisi_uranus_bigtts": "zh-CN-liaoning-XiaobeiNeural",
+ "zh_female_vv_uranus_bigtts": "zh-CN-shaanxi-XiaoniNeural",
+ "zh_female_xiaohe_uranus_bigtts": "zh-CN-XiaoxiaoNeural",
+}
+
# Template audio_config.voice_preset aliases → speaker
VOICE_ALIASES: dict[str, str] = {
"narrator_calm": "zh_female_cancan_uranus_bigtts",
@@ -154,7 +183,10 @@ def infer_speaker_gender(speaker: str) -> str | None:
def edge_tts_voice_for_speaker(speaker: str) -> str:
- """edge-tts 兜底:按 speaker 前缀选中文 neural 声线。"""
+ """edge-tts 兜底:按豆包 speaker 映射不同中文 neural,避免全员同一条 Yunxi。"""
+ mapped = EDGE_TTS_BY_SPEAKER.get((speaker or "").strip())
+ if mapped:
+ return mapped
g = infer_speaker_gender(speaker)
if g == "male":
return "zh-CN-YunxiNeural"
@@ -227,7 +259,7 @@ def infer_speaker_from_voice_prompt(voice_prompt: str, *, character_name: str =
PREVIEW_TEXT = "大家好,这是当前音色的试听效果,适合科普短视频旁白讲解。"
# 试听缓存文件名后缀:TTS 路由/edge 性别修复后递增,避免继续播放旧错误样例
-PREVIEW_CACHE_TAG = "v2"
+PREVIEW_CACHE_TAG = "v3"
async def ensure_voice_preview(voice_id: str) -> str:
diff --git a/backend/tests/test_ark_upstream_timeout.py b/backend/tests/test_ark_upstream_timeout.py
new file mode 100644
index 0000000..fc77fa9
--- /dev/null
+++ b/backend/tests/test_ark_upstream_timeout.py
@@ -0,0 +1,47 @@
+"""TokenFree 图/视频 HTTP 超时:读体要够长,ReadTimeout 文案区分于连不上。"""
+
+import pytest
+import httpx
+
+from app.services.ark import (
+ IMAGE_GEN_READ_SEC,
+ VIDEO_CREATE_READ_SEC,
+ _upstream_timeout,
+ reraise_upstream_timeout,
+)
+from app.services.exc_format import format_exception_message
+
+
+def test_image_read_timeout_is_at_least_10_minutes():
+ assert IMAGE_GEN_READ_SEC >= 600.0
+ timeout = _upstream_timeout(IMAGE_GEN_READ_SEC)
+ assert timeout.connect == 30.0
+ assert timeout.read == IMAGE_GEN_READ_SEC
+ assert timeout.write == 60.0
+
+
+def test_video_create_timeout_longer_than_old_60s():
+ assert VIDEO_CREATE_READ_SEC >= 180.0
+ timeout = _upstream_timeout(VIDEO_CREATE_READ_SEC)
+ assert timeout.read == VIDEO_CREATE_READ_SEC
+
+
+def test_reraise_read_timeout_says_waiting_not_unreachable():
+ with pytest.raises(RuntimeError, match="等待上游超时") as ei:
+ reraise_upstream_timeout(httpx.ReadTimeout(""), kind="生图", read_sec=600)
+ text = str(ei.value)
+ assert "无法连接" not in text
+ assert "600" in text
+ wrapped = format_exception_message(ei.value)
+ assert "等待上游超时" in wrapped
+
+
+def test_reraise_write_timeout_says_send_not_wait():
+ with pytest.raises(RuntimeError, match="发送请求超时") as ei:
+ reraise_upstream_timeout(httpx.WriteTimeout(""), kind="生图", read_sec=600)
+ assert "等待上游超时" not in str(ei.value)
+
+
+def test_reraise_connect_timeout_says_unreachable():
+ with pytest.raises(RuntimeError, match="无法连接上游"):
+ reraise_upstream_timeout(httpx.ConnectTimeout(""), kind="生视频", read_sec=180)
diff --git a/backend/tests/test_exc_format.py b/backend/tests/test_exc_format.py
new file mode 100644
index 0000000..6844c2e
--- /dev/null
+++ b/backend/tests/test_exc_format.py
@@ -0,0 +1,32 @@
+"""网络异常文案:ReadTimeout 不得再写成「连不上」。"""
+
+import httpx
+
+from app.services.exc_format import format_exception_message
+
+
+def test_read_timeout_says_response_timed_out():
+ msg = format_exception_message(httpx.ReadTimeout(""))
+ assert "ReadTimeout" in msg
+ assert "响应超时" in msg
+ assert "无法连接上游服务" not in msg
+
+
+def test_connect_error_still_says_unreachable():
+ msg = format_exception_message(httpx.ConnectError(""))
+ assert "无法连接上游服务" in msg
+ assert "ReadTimeout" not in msg
+
+
+def test_connect_timeout_not_treated_as_read_timeout():
+ msg = format_exception_message(httpx.ConnectTimeout(""))
+ assert "无法连接上游服务" in msg
+ assert "响应超时" not in msg
+
+
+def test_write_timeout_says_send_timed_out():
+ msg = format_exception_message(httpx.WriteTimeout(""))
+ assert "WriteTimeout" in msg
+ assert "发送请求超时" in msg
+ assert "无法连接上游服务" not in msg
+ assert "响应超时" not in msg
diff --git a/backend/tests/test_seedance_prompt_sanitize.py b/backend/tests/test_seedance_prompt_sanitize.py
index 45e0054..48748b9 100644
--- a/backend/tests/test_seedance_prompt_sanitize.py
+++ b/backend/tests/test_seedance_prompt_sanitize.py
@@ -100,7 +100,8 @@ def test_os_stage_stays_inner_monologue():
assert "【对白" in closeup
-def test_unlabeled_speaker_keeps_reference_audio():
+def test_unlabeled_speaker_skips_reference_audio():
+ """对白仍改写成【对白】,但暂不把试听挂进 content。"""
script = "@duration:6\n禹:水患未平。"
reference = [_char(1, "禹", audio="https://cdn.example.com/yu.mp3")]
items = build_seedance_content_items(script, reference, burn_subtitles=False)
@@ -109,8 +110,9 @@ def test_unlabeled_speaker_keeps_reference_audio():
for item in items
if item.get("type") == "audio_url"
]
- assert audios == ["https://cdn.example.com/yu.mp3"]
+ assert audios == []
assert "【对白" in items[0]["text"]
+ assert "【强制约束:角色音色】" not in items[0]["text"]
def test_character_vo_narration_becomes_dialogue_not_stage_direction():
@@ -132,25 +134,25 @@ def test_true_third_person_narration_stays_narration():
assert "【对白" not in fixed
-def test_silent_character_reference_audio_omitted():
+def test_bound_voice_not_submitted_as_reference_audio():
+ """已绑定试听也不提交 reference_audio,口播交给模型。"""
items = build_seedance_content_items(_ACI_SCRIPT, _ACI_REFERENCE, burn_subtitles=False)
audios = [
item["audio_url"]["url"]
for item in items
if item.get("type") == "audio_url"
]
- assert audios == ["https://cdn.example.com/aci.mp3"]
+ assert audios == []
text = items[0]["text"]
- assert "阿词:参考音频1" in text
- assert "小胖:参考音频" not in text
+ assert "【强制约束:角色音色】" not in text
+ assert "参考音频" not in text
labels = describe_seedance_content_slots(
_ACI_REFERENCE,
None,
has_text=True,
content=_ACI_SCRIPT,
)
- assert any("阿词" in label and "音色" in label for label in labels)
- assert not any("小胖" in label and "音色" in label for label in labels)
+ assert not any("音色" in label for label in labels)
def test_peiyue_cue_feeds_production_bgm():
diff --git a/backend/tests/test_tokenfree_audio.py b/backend/tests/test_tokenfree_audio.py
index 21e907e..2ecd43b 100644
--- a/backend/tests/test_tokenfree_audio.py
+++ b/backend/tests/test_tokenfree_audio.py
@@ -2,6 +2,7 @@
from app.services.tokenfree_audio import (
resolve_tokenfree_tts_model,
+ tokenfree_speech_honors_speaker,
tokenfree_speech_voice,
uses_tokenfree_audio,
)
@@ -24,3 +25,10 @@ def test_tokenfree_speech_voice_gender():
assert tokenfree_speech_voice("zh_female_cancan_uranus_bigtts") == "Cherry"
assert tokenfree_speech_voice("zh_male_shaonianzixin_uranus_bigtts") == "Ethan"
assert tokenfree_speech_voice("Cherry") == "Cherry"
+
+
+def test_tokenfree_speech_does_not_honor_doubao_ids():
+ assert tokenfree_speech_honors_speaker("Cherry") is True
+ assert tokenfree_speech_honors_speaker("ethan") is True
+ assert tokenfree_speech_honors_speaker("zh_male_shaonianzixin_uranus_bigtts") is False
+ assert tokenfree_speech_honors_speaker("S_abc") is False
diff --git a/backend/tests/test_tts_speaker_gender.py b/backend/tests/test_tts_speaker_gender.py
index bbeb4a1..e4d07a0 100644
--- a/backend/tests/test_tts_speaker_gender.py
+++ b/backend/tests/test_tts_speaker_gender.py
@@ -18,3 +18,15 @@ def test_edge_voice_xiaohe_is_female_neural():
def test_edge_voice_male_preset():
assert edge_tts_voice_for_speaker("zh_male_shaonianzixin_uranus_bigtts") == "zh-CN-YunxiNeural"
+
+
+def test_edge_voice_male_presets_are_not_all_yunxi():
+ voices = {
+ edge_tts_voice_for_speaker("zh_male_shaonianzixin_uranus_bigtts"),
+ edge_tts_voice_for_speaker("zh_male_m191_uranus_bigtts"),
+ edge_tts_voice_for_speaker("zh_male_baqiqingshu_uranus_bigtts"),
+ edge_tts_voice_for_speaker("zh_male_taocheng_uranus_bigtts"),
+ }
+ assert len(voices) >= 3
+ assert "zh-CN-YunyangNeural" in voices
+ assert "zh-CN-YunxiaNeural" not in voices
diff --git a/backend/tests/test_tts_tokenfree_fallback.py b/backend/tests/test_tts_tokenfree_fallback.py
index 39bee43..b68c897 100644
--- a/backend/tests/test_tts_tokenfree_fallback.py
+++ b/backend/tests/test_tts_tokenfree_fallback.py
@@ -45,6 +45,33 @@ async def test_tts_tokenfree_falls_back_to_edge(tmp_path: Path, monkeypatch: pyt
silence.assert_not_called()
+async def test_tts_skips_qwen_for_doubao_speaker(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ """豆包 zh_male_* 不能先走 qwen(会全员 Ethan),应直接 edge-tts。"""
+ gw = ArkGateway(settings=_tts_settings())
+ monkeypatch.setattr("app.services.storage.project_dir", lambda _pid: tmp_path)
+ monkeypatch.setattr("app.services.storage.publish_local", lambda p: f"/static/{Path(p).name}")
+ monkeypatch.setattr(gw, "_ark_api_key", lambda: "sk-test")
+ monkeypatch.setattr(gw, "_tts_openspeech", AsyncMock(return_value=False))
+ speech = AsyncMock(return_value=True)
+ monkeypatch.setattr(gw, "_tts_openai_speech", speech)
+ monkeypatch.setattr("app.services.ark.is_near_silent_audio", lambda _p: False)
+
+ async def fake_edge(text: str, dest: Path, voice_hint: str = "") -> None:
+ dest.parent.mkdir(parents=True, exist_ok=True)
+ dest.write_bytes(b"a" * 4000)
+
+ monkeypatch.setattr(gw, "_tts_edge", fake_edge)
+
+ url = await gw.tts(
+ "你好。",
+ "zh_male_shaonianzixin_uranus_bigtts",
+ project_id=1,
+ shot_no=3,
+ )
+ assert url.endswith("shot_003_tts.mp3")
+ speech.assert_not_called()
+
+
async def test_tts_raises_when_all_providers_fail(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
"""全部语音上游失败时直接报错,不再写静音文件冒充成功。"""
gw = ArkGateway(settings=_tts_settings())
diff --git a/backend/tests/test_voice_synthesis.py b/backend/tests/test_voice_synthesis.py
index c6966b1..f1a00bf 100644
--- a/backend/tests/test_voice_synthesis.py
+++ b/backend/tests/test_voice_synthesis.py
@@ -6,7 +6,7 @@ from app.services.drama.voice_synthesis import (
normalize_character_name,
)
from app.services.ark import ArkGateway
-from app.services.voices import infer_drama_speaker_from_prompt
+from app.services.voices import infer_drama_speaker_from_prompt, infer_speaker_gender
def test_normalize_character_name_strips_suffix() -> None:
@@ -30,6 +30,63 @@ def test_build_voice_sample_text_short_mode() -> None:
)
+def test_infer_drama_speaker_screenshot_cast_differs() -> None:
+ """词源爷爷/GBE/小胖/剪影/阿词 不能再全员落到同一条少年音。"""
+ gbe = infer_drama_speaker_from_prompt(
+ "神圣与委屈交织的萌系精灵音色,完全体为成年男性管风琴共鸣声线,"
+ "低沉恢弘带悲悯感,语速庄重缓慢;压缩态转为高亮童声质感",
+ character_name="GBE",
+ asset_id=1,
+ )
+ xiaopang = infer_drama_speaker_from_prompt(
+ "12岁男孩,童声偏圆润饱满,音域中等偏亮,自带憨厚的鼻音质感。",
+ character_name="小胖",
+ asset_id=2,
+ )
+ grandpa = infer_drama_speaker_from_prompt(
+ "严厉下的天真知识狂魔,孤独感与热切感交织,半秒间完成肃穆到雀跃的变调。",
+ character_name="词源爷爷",
+ asset_id=3,
+ )
+ silhouette = infer_drama_speaker_from_prompt(
+ "青年男声,二十五岁上下,声线偏冷偏低沉,尾音略带颗粒感与克制感。",
+ character_name="人物剪影",
+ asset_id=4,
+ )
+ aci = infer_drama_speaker_from_prompt(
+ "12岁少年音,清亮偏高的声线带着青春期变声前的透亮质感。",
+ character_name="阿词",
+ asset_id=5,
+ )
+ speakers = {gbe, xiaopang, grandpa, silhouette, aci}
+ assert len(speakers) == 5
+ assert grandpa == "zh_male_baqiqingshu_uranus_bigtts"
+ assert aci == "zh_male_shaonianzixin_uranus_bigtts"
+ assert xiaopang == "zh_male_taocheng_uranus_bigtts"
+ assert gbe == "zh_male_m191_uranus_bigtts"
+ assert silhouette == "zh_male_ruyayichen_uranus_bigtts"
+
+
+def test_infer_drama_speaker_youth_fallback_not_uncle() -> None:
+ """默认「青年男声…语速沉稳」不能再落到霸气青叔。"""
+ speaker = infer_drama_speaker_from_prompt(
+ "青年男声,吐字清晰,语速沉稳",
+ character_name="路人甲",
+ asset_id=11,
+ )
+ assert speaker == "zh_male_taocheng_uranus_bigtts"
+
+
+def test_infer_drama_speaker_shao_ye_not_grandpa() -> None:
+ speaker = infer_drama_speaker_from_prompt(
+ "青年声线,吐字清晰",
+ character_name="少爷",
+ asset_id=12,
+ )
+ assert infer_speaker_gender(speaker) == "male"
+ assert speaker != "zh_male_baqiqingshu_uranus_bigtts"
+
+
def test_infer_drama_speaker_differs_by_role() -> None:
yu = infer_drama_speaker_from_prompt(
"中年男性,治水领袖,声线浑厚庄重",
diff --git a/docs/EPISODE_RULES.md b/docs/EPISODE_RULES.md
index ee2d6e8..3b5fcee 100644
--- a/docs/EPISODE_RULES.md
+++ b/docs/EPISODE_RULES.md
@@ -159,18 +159,21 @@ LLM 分镜**禁止**直接输出 `@asset` / `@duration` / `【字幕】【BGM】
### 4.1 本镜引用范围
-- 只引用**本镜真正用到的**角色图 / 场景图 / 音色
+- 只引用**本镜真正用到的**角色图 / 场景图
- 稳定优先:主体参考图约 **1–8**,勿一镜塞满 30 张
- `character_names`:仅正文点到的出镜角色;群演可省略
-### 4.2 音色
+### 4.2 音色(暂关)
+
+当前**不绑定、不提交** `reference_audio`。口播由 Seedance `generate_audio` 按对白/旁白自行发挥。角色图仍作 `reference_image`。
| 规则 | 说明 |
|------|------|
-| 要对白的角色 | 必须绑定试听(`reference_audio`);**本镜未开口的角色只挂形象图,不挂音色** |
+| 要对白的角色 | 不强制试听;写清对白即可 |
| 角色 VO | `角色(vo):台词` 走对白/内心独白,不是第三人称旁白;纯 `角色(vo,情绪)。` 是舞台指示,禁止口播 |
-| 旁白 | 可用项目级旁白音色;仅第三人称旁白行才挂旁白参考音频 |
-| 时长 | 合成后截到 **≤15s**(API 单条/合计上限约 30s) |
+| 旁白 | 第三人称旁白行由模型配音,不挂项目级旁白音频 |
+
+<!-- 恢复绑定后改回:要对白的角色必须绑定试听;未开口角色只挂形象图 -->
### 4.3 人物介绍叠字
@@ -222,7 +225,7 @@ AI 重新分镜(`fragment_plan`)须按上述公式输出画面行;单镜
| 字段 | 来源 |
|------|------|
| `model` | 顶栏模型 |
-| `content[]` | text 提示词 + reference_image + reference_audio |
+| `content[]` | text 提示词 + reference_image(暂不提交 reference_audio) |
| `duration` | `@duration` 合计(4–30) |
| `ratio` / `resolution` | 顶栏 |
| `generate_audio` | `true`(短剧口播) |
@@ -233,9 +236,10 @@ AI 重新分镜(`fragment_plan`)须按上述公式输出画面行;单镜
1. 画面风格强制约束
2. 音频/字幕/BGM 强制约束(区分画面-only vs 对白/旁白)
-3. 角色/旁白音色 → 参考音频序号
-4. 角色形象 / 场景 → 参考图序号
-5. 正文(已替换 asset / duration)
+3. 角色形象 / 场景 / 道具 → 参考图序号
+4. 正文(已替换 asset / duration)
+
+(角色/旁白音色 → 参考音频序号:暂关)
---
@@ -304,9 +308,8 @@ AI 重新分镜(`fragment_plan`)须按上述公式输出画面行;单镜
### 9.3 资产
-- [ ] 出镜角色有图;说话角色有音色
+- [ ] 出镜角色有图
- [ ] 本镜引用未明显超量
-- [ ] 音色试听 ≤15s
### 9.4 提交
diff --git a/docs/SEEDANCE_2_5.md b/docs/SEEDANCE_2_5.md
index 2aa0b0e..6309209 100644
--- a/docs/SEEDANCE_2_5.md
+++ b/docs/SEEDANCE_2_5.md
@@ -171,7 +171,7 @@
| 脚本 `@duration` 合计 | `duration`(钳制约 4–30) |
| 分镜正文 + 强制约束块 | `content[]` 中 `type=text` |
| 角色/场景封面 | `image_url` + `role=reference_image` |
-| 角色/旁白试听 | `audio_url` + `role=reference_audio`(源头截到约 15s) |
+| 角色/旁白试听 | **暂不提交** `reference_audio`;口播由 `generate_audio` 自发挥 |
| 原生配音 | `generate_audio: true` |
| 水印 | `watermark: false` |
| 尾帧 | `return_last_frame: true` |
@@ -180,9 +180,10 @@
1. 【强制约束:视频画面风格】
2. 【强制约束:音频、字幕与配乐】
-3. 角色/旁白音色 → 参考音频序号
-4. 角色形象 / 场景 / 道具 → 参考图序号
-5. 正文:`@asset` →「名称(参考图 N)」(正文已有同名则不叠写);`@duration:N` → `00:00-00:04` 时间区间
+3. 角色形象 / 场景 / 道具 → 参考图序号
+4. 正文:`@asset` →「名称(参考图 N)」(正文已有同名则不叠写);`@duration:N` → `00:00-00:04` 时间区间
+
+(角色/旁白音色 → 参考音频:暂关)
分镜 cue:
diff --git a/docs/SHOT_SPLITTING.md b/docs/SHOT_SPLITTING.md
index 7e7ea25..f0d6ec3 100644
--- a/docs/SHOT_SPLITTING.md
+++ b/docs/SHOT_SPLITTING.md
@@ -176,7 +176,7 @@ Seedance 2.5 **单次最长约 30 秒**,可在一段里做多镜头叙事,
- [ ] 单镜合计时长 ≤ 30s,单段 3–12s
- [ ] 空镜 / 景别描写已是「画面」前缀,不会被念
- [ ] 有口播则有对应旁白/对白 cue;无口播则不要写「同步字幕」对白前缀
-- [ ] 出镜角色有参考图;要说话的角色已绑音色
+- [ ] 出镜角色有参考图;口播无需绑定音色
- [ ] 顶栏画幅 / 清晰度 / 风格与本集一致
- [ ] 未在普通生成 prompt 里误写「编辑/延长」类措辞(避免任务被重分类)
diff --git a/docs/releases/2026-09-16.md b/docs/releases/2026-09-16.md
index c8a450c..6b02338 100644
--- a/docs/releases/2026-09-16.md
+++ b/docs/releases/2026-09-16.md
@@ -1,4 +1,37 @@
-## 2026-09-16 14:21 · 生图改回 gpt-image-2-5(sunburst 无线路)(全量)
+## 2026-09-16 16:06 · 漫剧暂关音色绑定/提交,口播交给 Seedance(全量)
+
+- **操作者**:Agent
+- **方式**:`deploy_kepu_8136.py` 全量(`SKIP_BOOTSTRAP=1`);发布前打回滚包
+- **范围**:frontend / api
+- **变更摘要**:
+ - 漫剧不再绑定、不再提交 `reference_audio`;对白/旁白由 Seedance `generate_audio` 自行发挥
+ - 资产库隐藏「音色」分类与生成/绑定入口;生成前不再警告未绑音色
+ - 顺带:TokenFree qwen 不再把豆包男声全压成 Ethan;edge-tts 按角色分声线(恢复音色开关后才用到)
+- **验证**:
+ - [x] 远端 `http://127.0.0.1:8000/api/health` → `ok:true`,task_runtime healthy
+ - [x] `https://www.printfilm.com/api/health` → `ok:true`
+ - [x] 远端 `SEEDANCE_ATTACH_REFERENCE_AUDIO` → `False`
+ - [x] `https://www.printfilm.com/` → 200(`index-BA1hs1fb.js`,`Last-Modified: Wed, 16 Sep 2026 08:05:31 GMT`);包内有「无需绑定音色」
+ - [x] `https://admin.printfilm.com/` → 200
+ - [x] `ai-movie-api` active;worker 保持停用
+- **备注 / 回滚**:
+ - 回滚包:`/opt/ai_movie_rollback_20260916-160555.tgz`(89M,不含 venv / 生成媒体)
+ - 环境备份:`/opt/ai_movie_rollback_20260916-160555.env`
+ - 未改 nginx / 证书 / Postgres·Redis 容器
+ - 已生成镜头需再点一次生成,口播才会改走模型自配
+ - 回滚命令(在服务器执行):
+
+```bash
+systemctl stop ai-movie-api
+mv /opt/ai_movie/backend/.venv /tmp/ai_movie_venv_keep
+rm -rf /opt/ai_movie
+tar -xzf /opt/ai_movie_rollback_20260916-160555.tgz -C /opt
+mv /tmp/ai_movie_venv_keep /opt/ai_movie/backend/.venv
+cp -a /opt/ai_movie_rollback_20260916-160555.env /opt/ai_movie/backend/.env
+systemctl start ai-movie-api
+```
+
+
- **操作者**:Agent
- **方式**:`deploy_kepu_8136.py` 全量(`SKIP_BOOTSTRAP=1`);发布前打回滚包
diff --git a/docs/releases/README.md b/docs/releases/README.md
index a92a588..9032fe5 100644
--- a/docs/releases/README.md
+++ b/docs/releases/README.md
@@ -33,6 +33,7 @@
| 日期 | 摘要 | 文件 |
|------|------|------|
+| 2026-09-16 | 漫剧暂关音色绑定/提交,口播交给 Seedance;杭州全量(可回滚) | [2026-09-16.md](./2026-09-16.md) |
| 2026-09-16 | 生图改回 gpt-image-2-5(sunburst 无线路);杭州全量(可回滚) | [2026-09-16.md](./2026-09-16.md) |
| 2026-09-16 | 科普去掉配乐字幕选项 + 假垫乐杂音;杭州全量(可回滚) | [2026-09-16.md](./2026-09-16.md) |
| 2026-09-16 | 生图按 Kie sunburst 计费 + 首页获客标签;杭州全量(可回滚) | [2026-09-16.md](./2026-09-16.md) |
diff --git a/frontend/src/components/drama/SeedanceRulesModal.tsx b/frontend/src/components/drama/SeedanceRulesModal.tsx
index 50f519c..254b418 100644
--- a/frontend/src/components/drama/SeedanceRulesModal.tsx
+++ b/frontend/src/components/drama/SeedanceRulesModal.tsx
@@ -101,9 +101,11 @@ export function SeedanceRulesModal({ open, onClose }: Props) {
<li>
<strong>reference_image</strong>:本镜引用角色 / 场景 / 道具的封面或主图
</li>
+ {/* 音色难控:暂不提交 reference_audio,口播由 generate_audio 自发挥
<li>
<strong>reference_audio</strong>:已绑定音色的角色与旁白试听音频
</li>
+ */}
</ol>
<p className="seedance-rules-note">
系统默认开启 <code>generate_audio</code>:有口播意图时 Seedance 原生配音并烧录字幕;纯画面镜仅环境音、不烧字幕。
@@ -113,8 +115,10 @@ export function SeedanceRulesModal({ open, onClose }: Props) {
<ol className="seedance-rules-list">
<li>【强制约束:视频画面风格】— 项目所选画风描述</li>
<li>【强制约束:音频、字幕与配乐】— 根据脚本旁白 / 对白 / 画面 cue 推断</li>
+ {/*
<li>【强制约束:角色音色】— 角色名 → 参考音频序号</li>
<li>【强制约束:旁白音色】— 旁白 → 参考音频序号</li>
+ */}
<li>【强制约束:角色形象】— 角色名 → 参考图序号</li>
<li>【强制约束:场景】— 场景名 → 参考图序号</li>
<li>【强制约束:道具】— 道具名 → 参考图序号</li>
@@ -146,7 +150,7 @@ export function SeedanceRulesModal({ open, onClose }: Props) {
<code>@asset:123</code>:在正文中引用 ID 为 123 的角色 / 场景 / 道具
</li>
<li>左侧资产面板点击资产,或本镜「参与资产」条,也会自动写入引用</li>
- <li>被引用的角色需有参考图;需口播的角色需绑定音色(参考音频)</li>
+ <li>被引用的角色需有参考图;口播由 Seedance 按对白/旁白自行发挥,无需绑定音色</li>
</ul>
<h4>漫剧常用 cue(勿用科普版「全程旁白烧录」字幕句)</h4>
@@ -194,7 +198,7 @@ export function SeedanceRulesModal({ open, onClose }: Props) {
<h4>生成前检查</h4>
<ul className="seedance-rules-list">
<li>脚本校验:时长合法;空镜未被标成对白/旁白(编辑区会即时提示,有错误不可生成)</li>
- <li>本镜「参与资产」中的角色已有参考图;需说话的角色已「生成音色」或绑定试听(缺项会警告)</li>
+ <li>本镜「参与资产」中的角色已有参考图(缺图会警告);口播无需绑定音色</li>
<li>项目顶栏确认画幅与清晰度;分集顶栏确认视频风格、模型后再点「生成」</li>
</ul>
@@ -221,10 +225,9 @@ export function SeedanceRulesModal({ open, onClose }: Props) {
</li>
</ul>
- <h4>音色与参考音频</h4>
+ <h4>音色与参考音频(暂关)</h4>
<ul className="seedance-rules-list">
- <li>角色 / 旁白音色试听会作为 reference_audio 提交,保证口播声线一致</li>
- <li>参考音频合成后自动截到 15 秒内(API 单条上限约 30 秒)</li>
+ <li>暂不提交 reference_audio、不绑定角色/旁白试听;口播由 Seedance 原生配音自行发挥</li>
<li>缺少参考图时,系统会尝试自动补图后再提交 Seedance</li>
</ul>
diff --git a/frontend/src/lib/dramaEpisodeScriptValidate.ts b/frontend/src/lib/dramaEpisodeScriptValidate.ts
index fcd6bd4..20a70fa 100644
--- a/frontend/src/lib/dramaEpisodeScriptValidate.ts
+++ b/frontend/src/lib/dramaEpisodeScriptValidate.ts
@@ -11,6 +11,7 @@ import {
FRAGMENT_CONTENT_DURATION_MAX,
} from './dramaEpisodePromptEditor'
import { extractDurations, sumDuration } from './segmentDuration'
+import { DRAMA_VOICE_BINDING_ENABLED } from './dramaVoiceBinding'
/** 漫剧字幕 cue(与后端 DRAMA_SUBTITLE_CUE 一致) */
export const DRAMA_SUBTITLE_CUE = '【字幕:底部居中·简体中文·逐句轮换·与口播同步】'
@@ -202,7 +203,7 @@ export function validateDramaFragmentAssets(
if ((kind === 'character' || kind === 'scene' || kind === 'prop') && !hasImage) {
missingImage.push(asset.name || `#${id}`)
}
- if (kind === 'character' && needsVoice && !assetHasVoiceBinding(asset)) {
+ if (DRAMA_VOICE_BINDING_ENABLED && kind === 'character' && needsVoice && !assetHasVoiceBinding(asset)) {
missingVoice.push(asset.name || `#${id}`)
}
}
diff --git a/frontend/src/lib/dramaGenError.ts b/frontend/src/lib/dramaGenError.ts
index 744bd09..90b0ccd 100644
--- a/frontend/src/lib/dramaGenError.ts
+++ b/frontend/src/lib/dramaGenError.ts
@@ -70,7 +70,16 @@ export function formatDramaGenError(raw: string | null | undefined): DramaGenErr
}
}
- if (/网络错误|ConnectError|ConnectTimeout|ReadTimeout|无法连接上游|tokenfree\.com|api\.kie\.ai/i.test(text)) {
+ if (/ReadTimeout|WriteTimeout|等待上游超时|响应超时/i.test(text)) {
+ return {
+ title: '上游响应超时',
+ message: text.length > 200 ? `${text.slice(0, 200)}…` : text,
+ suggestion:
+ '已经连上 TokenFree,但出图/出视频等待超过上限。请稍后重试;若文本能生成、只有图/视频超时,多半是上游排队较慢,不是代理断网。',
+ }
+ }
+
+ if (/网络错误|ConnectError|ConnectTimeout|无法连接上游|tokenfree\.com|api\.kie\.ai/i.test(text)) {
return {
title: '无法连接图片/视频服务',
message: text.length > 200 ? `${text.slice(0, 200)}…` : text,
diff --git a/frontend/src/lib/dramaVoiceBinding.ts b/frontend/src/lib/dramaVoiceBinding.ts
new file mode 100644
index 0000000..c0aeec7
--- /dev/null
+++ b/frontend/src/lib/dramaVoiceBinding.ts
@@ -0,0 +1,2 @@
+/** 音色难控:暂不绑定、不提交 Seedance reference_audio,口播由模型自发挥。恢复时改 true。 */
+export const DRAMA_VOICE_BINDING_ENABLED = false
diff --git a/frontend/src/pages/drama/AssetLibraryPage.tsx b/frontend/src/pages/drama/AssetLibraryPage.tsx
index 79c6e65..c3b69fb 100644
--- a/frontend/src/pages/drama/AssetLibraryPage.tsx
+++ b/frontend/src/pages/drama/AssetLibraryPage.tsx
@@ -17,6 +17,7 @@ import {
import { readAssetVoiceBinding } from './CharacterVoiceBindModal'
import { DramaImageLightbox } from './DramaImageLightbox'
import { filterDramaLibraryAssets, isDramaLibraryAsset } from '../../lib/dramaLibraryAssets'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
import { pageCountOf } from '../../lib/pagination'
import RequireAuth from './RequireAuth'
import './drama.css'
@@ -31,7 +32,7 @@ const TABS: Array<{ value: AssetTabKey; label: string }> = [
{ value: 'character', label: '角色' },
{ value: 'scene', label: '场景' },
{ value: 'prop', label: '道具' },
- { value: 'voice', label: '音色' },
+ ...(DRAMA_VOICE_BINDING_ENABLED ? [{ value: 'voice' as const, label: '音色' }] : []),
]
const KIND_LABEL: Record<string, string> = {
@@ -59,6 +60,7 @@ function assetKind(asset: DramaAsset): AssetTabKey | 'other' {
function matchTab(asset: DramaAsset, tab: AssetTabKey): boolean {
if (!isDramaLibraryAsset(asset)) return false
+ if (!DRAMA_VOICE_BINDING_ENABLED && assetKind(asset) === 'voice') return false
if (tab === 'all') return true
return assetKind(asset) === tab
}
@@ -312,7 +314,7 @@ function AssetLibraryInner() {
{fileMeta(asset)} · {projectLabel}
</p>
<div className="pf-asset-card-actions">
- {previewUrl && !isVoice ? (
+ {DRAMA_VOICE_BINDING_ENABLED && previewUrl && !isVoice ? (
<CharacterVoicePreviewButton
url={previewUrl}
label={asset.name || undefined}
diff --git a/frontend/src/pages/drama/AssetsStep.tsx b/frontend/src/pages/drama/AssetsStep.tsx
index 76748c3..a6eb99e 100644
--- a/frontend/src/pages/drama/AssetsStep.tsx
+++ b/frontend/src/pages/drama/AssetsStep.tsx
@@ -31,6 +31,7 @@ import { alertDramaGenError, formatDramaGenError, isUpstreamAccountError } from
import { pageCountOf } from '../../lib/pagination'
import { readVisualPrompt } from '../../lib/dramaVisualPrompt'
import { filterDramaLibraryAssets } from '../../lib/dramaLibraryAssets'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
import {
dramaAssetImageGenButtonLabel,
dramaAssetNeedsImageGeneration,
@@ -42,7 +43,7 @@ const ASSET_TABS: Array<{ key: AssetTabKey; label: string }> = [
{ key: 'character', label: '角色' },
{ key: 'scene', label: '场景' },
{ key: 'prop', label: '道具' },
- { key: 'voice', label: '音色' },
+ ...(DRAMA_VOICE_BINDING_ENABLED ? [{ key: 'voice' as const, label: '音色' }] : []),
]
const PAGE_SIZE_DEFAULT = 12
@@ -684,7 +685,7 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
<div className="drama-assets-tips" role="note">
<Sparkles size={15} strokeWidth={1.75} aria-hidden />
- <span>随时管理角色、场景、道具与音色。确认分集剧本时会自动抽取本集相关资产,出图可在此补做。</span>
+ <span>随时管理角色、场景与道具。确认分集剧本时会自动抽取本集相关资产,出图可在此补做。</span>
</div>
<div className="drama-assets-toolbar">
@@ -706,12 +707,12 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
新增角色
</button>
) : null}
- {tab === 'voice' ? (
+ {DRAMA_VOICE_BINDING_ENABLED && tab === 'voice' ? (
<button type="button" className="pf-btn" onClick={() => void handleAddVoice()}>
新增音色
</button>
) : null}
- {tab !== 'voice' ? (
+ {DRAMA_VOICE_BINDING_ENABLED && tab !== 'voice' ? (
<button
type="button"
className="pf-btn"
@@ -759,7 +760,7 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
</button>
) : null}
- {tab === 'character' ? (
+ {DRAMA_VOICE_BINDING_ENABLED && tab === 'character' ? (
<button
type="button"
className="pf-btn pf-btn-lime"
@@ -902,26 +903,28 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
</button>
{isCharacter ? (
<>
- {voice ? (
- <CharacterVoicePreviewButton
- url={voice.url}
- label={voice.label}
- onError={onError}
- />
- ) : (
- <button
- type="button"
- className="pf-btn pf-btn-sm pf-btn-lime"
- disabled={
- batchBusy ||
- batchVoiceBusy ||
- characterVoiceBusyIds.has(asset.id)
- }
- onClick={() => void handleGenerateCharacterVoice(asset)}
- >
- {characterVoiceBusyIds.has(asset.id) ? '生成中…' : '生成音色'}
- </button>
- )}
+ {DRAMA_VOICE_BINDING_ENABLED ? (
+ voice ? (
+ <CharacterVoicePreviewButton
+ url={voice.url}
+ label={voice.label}
+ onError={onError}
+ />
+ ) : (
+ <button
+ type="button"
+ className="pf-btn pf-btn-sm pf-btn-lime"
+ disabled={
+ batchBusy ||
+ batchVoiceBusy ||
+ characterVoiceBusyIds.has(asset.id)
+ }
+ onClick={() => void handleGenerateCharacterVoice(asset)}
+ >
+ {characterVoiceBusyIds.has(asset.id) ? '生成中…' : '生成音色'}
+ </button>
+ )
+ ) : null}
<button
type="button"
className="pf-btn pf-btn-sm drama-btn-danger-text"
@@ -968,7 +971,7 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
setDetailAsset(updated)
}}
onGenerate={(a) => enqueueOne(a)}
- onBindVoice={(a) => setVoiceAsset(a)}
+ onBindVoice={DRAMA_VOICE_BINDING_ENABLED ? (a) => setVoiceAsset(a) : undefined}
onDelete={(a) => {
setDetailAsset(null)
void handleDeleteCharacter(a)
@@ -985,7 +988,7 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
/>
) : null}
- {voiceAsset ? (
+ {DRAMA_VOICE_BINDING_ENABLED && voiceAsset ? (
<CharacterVoiceBindModal
asset={voiceAsset}
projectId={projectId}
@@ -999,7 +1002,7 @@ export function AssetsStep({ projectId, onError }: AssetsStepProps) {
/>
) : null}
- {project ? (
+ {DRAMA_VOICE_BINDING_ENABLED && project ? (
<NarratorVoiceBindModal
project={project}
open={narratorVoiceOpen}
diff --git a/frontend/src/pages/drama/EpisodeEditAssetPanel.tsx b/frontend/src/pages/drama/EpisodeEditAssetPanel.tsx
index 3deee10..c675ba9 100644
--- a/frontend/src/pages/drama/EpisodeEditAssetPanel.tsx
+++ b/frontend/src/pages/drama/EpisodeEditAssetPanel.tsx
@@ -2,6 +2,7 @@
import { resolveDramaAssetPreviewUrl, type DramaAsset } from '../../api/drama'
import { CharacterVoicePreviewButton } from '../../components/drama/CharacterVoicePreviewButton'
import { readAssetVoiceBinding } from './CharacterVoiceBindModal'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
import {
ASSET_TABS,
normalizeAssetTab,
@@ -161,7 +162,9 @@ export function EpisodeEditAssetPanel({
</div>
<span className="drama-ep-asset-name">{asset.name || `资产 ${asset.id}`}</span>
{isActive ? <span className="drama-ep-asset-linked">已关联</span> : null}
- {voice ? <span className="drama-ep-asset-voice">音色</span> : null}
+ {DRAMA_VOICE_BINDING_ENABLED && voice ? (
+ <span className="drama-ep-asset-voice">音色</span>
+ ) : null}
<span className="drama-ep-asset-settings">设置</span>
</button>
<div className="drama-ep-asset-ops">
diff --git a/frontend/src/pages/drama/EpisodeEditPage.tsx b/frontend/src/pages/drama/EpisodeEditPage.tsx
index fba8bd9..812fdad 100644
--- a/frontend/src/pages/drama/EpisodeEditPage.tsx
+++ b/frontend/src/pages/drama/EpisodeEditPage.tsx
@@ -38,6 +38,7 @@ import {
collectDramaGenerateGateIssues,
formatDramaGateMessage,
} from '../../lib/dramaEpisodeScriptValidate'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
import BillingErrorNotice from '../../components/billing/BillingErrorNotice'
import { dialog } from '../../lib/dialog'
import {
@@ -1476,7 +1477,11 @@ function EpisodeEditInner() {
onOpenAsset={setDetailAsset}
onMention={mentionAsset}
onUnlinkAsset={unlinkSelectedAsset}
- onGenerateVoice={(asset) => void handleGenerateCharacterVoice(asset)}
+ onGenerateVoice={
+ DRAMA_VOICE_BINDING_ENABLED
+ ? (asset) => void handleGenerateCharacterVoice(asset)
+ : undefined
+ }
voiceBusyIds={characterVoiceBusyIds}
onVoiceError={(message) => setError(message)}
onCreateAsset={() => void handleCreateSideAsset()}
@@ -1845,12 +1850,12 @@ function EpisodeEditInner() {
onClose={() => setDetailAsset(null)}
onUpdated={handleCharacterUpdated}
onGenerate={(a) => enqueueAssetImage(a)}
- onBindVoice={(a) => setVoiceBindAsset(a)}
+ onBindVoice={DRAMA_VOICE_BINDING_ENABLED ? (a) => setVoiceBindAsset(a) : undefined}
onError={(message) => setError(message)}
/>
) : null}
- {voiceBindAsset ? (
+ {DRAMA_VOICE_BINDING_ENABLED && voiceBindAsset ? (
<CharacterVoiceBindModal
asset={voiceBindAsset}
projectId={pid}
diff --git a/frontend/src/pages/drama/EpisodeEditReferenceStrip.tsx b/frontend/src/pages/drama/EpisodeEditReferenceStrip.tsx
index f29b716..399a285 100644
--- a/frontend/src/pages/drama/EpisodeEditReferenceStrip.tsx
+++ b/frontend/src/pages/drama/EpisodeEditReferenceStrip.tsx
@@ -1,5 +1,6 @@
/** 分镜顶部:已关联资产缩略图条 */
import type { FragmentRefStripItem } from './dramaEpisodeEditUtils'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
type Props = {
items: FragmentRefStripItem[]
@@ -26,7 +27,11 @@ export function EpisodeEditReferenceStrip({ items, onSelect }: Props) {
item.voiceUrl ? ' has-voice' : item.isCharacter ? ' no-voice' : ''
}`}
title={`${item.name}${item.type ? ` · ${item.type}` : ''}${
- item.isCharacter ? (item.voiceLabel ? ` · 音色:${item.voiceLabel}` : ' · 未绑定音色') : ''
+ DRAMA_VOICE_BINDING_ENABLED && item.isCharacter
+ ? item.voiceLabel
+ ? ` · 音色:${item.voiceLabel}`
+ : ' · 未绑定音色'
+ : ''
}`}
onClick={() => onSelect?.(item.assetId)}
>
@@ -35,7 +40,7 @@ export function EpisodeEditReferenceStrip({ items, onSelect }: Props) {
) : (
<span className="drama-ep-ref-chip-fallback">{(item.name || '?')[0]}</span>
)}
- {item.isCharacter ? (
+ {DRAMA_VOICE_BINDING_ENABLED && item.isCharacter ? (
<span className={`drama-ep-ref-voice-badge${item.voiceUrl ? ' bound' : ''}`}>
{item.voiceUrl ? '音' : '无音'}
</span>
diff --git a/frontend/src/pages/drama/GlobalAssetPickerModal.tsx b/frontend/src/pages/drama/GlobalAssetPickerModal.tsx
index 0162f6b..90d2a94 100644
--- a/frontend/src/pages/drama/GlobalAssetPickerModal.tsx
+++ b/frontend/src/pages/drama/GlobalAssetPickerModal.tsx
@@ -2,6 +2,7 @@
import { useEffect, useMemo, useState } from 'react'
import { dramaApi, resolveDramaMediaUrl, type DramaAsset } from '../../api/drama'
import { filterDramaLibraryAssets, isDramaLibraryAsset } from '../../lib/dramaLibraryAssets'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../lib/dramaVoiceBinding'
import BillingErrorNotice from '../../components/billing/BillingErrorNotice'
import Modal from '../../components/ui/Modal'
import './drama.css'
@@ -28,7 +29,7 @@ const TABS: Array<{ key: GlobalAssetTabKey; label: string }> = [
{ key: 'character', label: '角色' },
{ key: 'scene', label: '场景' },
{ key: 'prop', label: '道具' },
- { key: 'voice', label: '音色' },
+ ...(DRAMA_VOICE_BINDING_ENABLED ? [{ key: 'voice' as const, label: '音色' }] : []),
]
// 资产是否匹配 Tab
@@ -67,7 +68,9 @@ export function GlobalAssetPickerModal({
* error 错误文案
*/
const [allAssets, setAllAssets] = useState<DramaAsset[]>([])
- const [tab, setTab] = useState<GlobalAssetTabKey>(defaultTab)
+ const [tab, setTab] = useState<GlobalAssetTabKey>(
+ defaultTab === 'voice' && !DRAMA_VOICE_BINDING_ENABLED ? 'character' : defaultTab,
+ )
const [query, setQuery] = useState('')
const [selectedId, setSelectedId] = useState<number | null>(null)
const [loading, setLoading] = useState(false)
@@ -76,7 +79,9 @@ export function GlobalAssetPickerModal({
useEffect(() => {
if (!open) return
- setTab(defaultTab)
+ setTab(
+ defaultTab === 'voice' && !DRAMA_VOICE_BINDING_ENABLED ? 'character' : defaultTab,
+ )
setQuery('')
setSelectedId(null)
setError('')
diff --git a/frontend/src/pages/drama/canvas/CanvasAssetNode.tsx b/frontend/src/pages/drama/canvas/CanvasAssetNode.tsx
index c49c94b..866bf80 100644
--- a/frontend/src/pages/drama/canvas/CanvasAssetNode.tsx
+++ b/frontend/src/pages/drama/canvas/CanvasAssetNode.tsx
@@ -14,6 +14,7 @@ import {
import { CanvasNodeGeneratePanel } from './nodes/CanvasNodeGeneratePanel'
import { CanvasNodePreviewModal } from './CanvasNodePreviewModal'
import { CanvasNodeUploadBar } from './nodes/CanvasNodeUploadBar'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../../lib/dramaVoiceBinding'
/** 画布视频缩略:仅展示封面,不拦截单击(单击要选中并显示提示词面板) */
function CanvasAssetVideoPreview({ src }: { src: string }) {
@@ -57,7 +58,7 @@ function CanvasAssetNodeComponent({ id, data, selected }: NodeProps<Node<CanvasA
: data.label || option.label
const footerLabel =
data.kind === 'character'
- ? voiceLabel
+ ? DRAMA_VOICE_BINDING_ENABLED && voiceLabel
? `基础形象 · ${voiceLabel}`
: '基础形象'
: data.kind === 'scene'
diff --git a/frontend/src/pages/drama/canvas/nodes/CanvasNodeUploadBar.tsx b/frontend/src/pages/drama/canvas/nodes/CanvasNodeUploadBar.tsx
index 6f35333..20b0d58 100644
--- a/frontend/src/pages/drama/canvas/nodes/CanvasNodeUploadBar.tsx
+++ b/frontend/src/pages/drama/canvas/nodes/CanvasNodeUploadBar.tsx
@@ -4,6 +4,7 @@ import { AudioLines, FolderOpen, Loader2, Upload } from 'lucide-react'
import { dramaApi } from '../../../../api/drama'
import { CharacterVoicePreviewButton } from '../../../../components/drama/CharacterVoicePreviewButton'
import { generateAndBindCharacterVoice } from '../../../../lib/characterVoiceGenerate'
+import { DRAMA_VOICE_BINDING_ENABLED } from '../../../../lib/dramaVoiceBinding'
import { useCanvasStore } from '../CanvasStore'
import { CANVAS_UPLOADABLE_KINDS, type CanvasNodeKind } from '../canvasTypes'
import {
@@ -120,7 +121,7 @@ export function CanvasNodeUploadBar({
<FolderOpen size={14} strokeWidth={1.8} />
从资产库选择
</button>
- {isCharacter ? (
+ {DRAMA_VOICE_BINDING_ENABLED && isCharacter ? (
hasVoice && voiceUrl ? (
<CharacterVoicePreviewButton
url={voiceUrl}