d7a1c8ee07
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 42s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 48s
CI/CD Pipeline / PR Build API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Successful in 24s
CI/CD Pipeline / PR Build Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Successful in 1m2s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
AI Code Review / AI Code Review (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
Preview Deploy / Deploy Preview Environment (pull_request) Has been cancelled
- Add TTS_STYLE_OPTIONS (6 presets: natural/excited/professional/sweet/news/livestream)
with DEFAULT_TTS_STYLE=natural and shared getTtsStyle() helper
- Add reusable TtsStyleSelector component (compact + normal modes, purple theme)
- Wire style param through all TTS paths:
* api/tts types: TTSSynthesizeRequest + TTSPreviewRequest add style?: string
* voices library: hook state → TtsModal compact selector → synthesize payload
* voice-materials library: hook state → TtsModal compact selector → payload
* generate Step5: formState → TtsVoiceModal (internal/external controlled)
→ synthesize payload → narrative video payload tts_style
* ai-avatar lipsync: hook state → PanelVoiceSelector → previewTts + createLipsyncJob
- SegmentTtsConfig adds style?: string for editing-planner TtsPanel (UI pending)
- All style params optional; backend will honor when supported, default natural
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
/**
|
||
* TTS 配音风格预设(情感/语气风格)
|
||
* - key:传给后端的 style 标识,便于后端按策略合成
|
||
* - 未传 style 时后端默认自然亲切
|
||
*
|
||
* 注:与原 emotion(CosyVoice 7 种基础情绪枚举)解耦;
|
||
* style 是更高层的"说话风格预设",后端可能映射到 emotion + speed + prompt 组合。
|
||
*/
|
||
|
||
export interface TtsStyleOption {
|
||
/** 传给后端的风格标识 */
|
||
value: string
|
||
/** 展示名 */
|
||
label: string
|
||
/** emoji 图标 */
|
||
emoji: string
|
||
/** 给用户/后端的风格描述(prompt 风格) */
|
||
description: string
|
||
}
|
||
|
||
export const TTS_STYLE_OPTIONS: readonly TtsStyleOption[] = [
|
||
{
|
||
value: "natural",
|
||
label: "自然亲切",
|
||
emoji: "😊",
|
||
description: "亲切自然,像朋友聊天",
|
||
},
|
||
{
|
||
value: "excited",
|
||
label: "激动兴奋",
|
||
emoji: "🤩",
|
||
description: "激动兴奋,语速稍快,充满活力",
|
||
},
|
||
{
|
||
value: "professional",
|
||
label: "沉稳专业",
|
||
emoji: "🧑💼",
|
||
description: "沉稳专业,语速适中,正式可靠",
|
||
},
|
||
{
|
||
value: "sweet",
|
||
label: "温柔甜美",
|
||
emoji: "🌸",
|
||
description: "温柔甜美,语速轻柔",
|
||
},
|
||
{
|
||
value: "news",
|
||
label: "新闻播报",
|
||
emoji: "📰",
|
||
description: "字正腔圆,严肃正式",
|
||
},
|
||
{
|
||
value: "livestream",
|
||
label: "直播带货",
|
||
emoji: "🎤",
|
||
description: "热情有感染力,有节奏感",
|
||
},
|
||
] as const
|
||
|
||
export type TtsStyle = (typeof TTS_STYLE_OPTIONS)[number]["value"]
|
||
|
||
/** 默认风格:自然亲切 */
|
||
export const DEFAULT_TTS_STYLE: TtsStyle = "natural"
|
||
|
||
/** 根据 value 查找风格选项(容错:找不到回退 natural) */
|
||
export function getTtsStyle(value: string | null | undefined): TtsStyleOption {
|
||
return (
|
||
(TTS_STYLE_OPTIONS as readonly TtsStyleOption[]).find((o) => o.value === value) ??
|
||
(TTS_STYLE_OPTIONS as readonly TtsStyleOption[])[0]
|
||
)
|
||
}
|