feat(capcut): 优化音频/字幕添加策略并重构语音切分逻辑

- 音频和字幕 API 调用改为先批量添加,批量失败时逐个兜底
- 重写 `splitIntoAudioSegments`,基于原始标点保留切分,合并短片段
- `qwen-tts.js` 补充中文逗号作为句末标点判断
This commit is contained in:
2026-05-06 23:21:40 +08:00
parent 6eec0e8889
commit b309f54430
4 changed files with 94 additions and 117 deletions

View File

@@ -71,7 +71,7 @@ function synthesize(text, options = {}) {
fs.mkdirSync(outputDir, { recursive: true })
text = text.trimEnd()
if (!/[。!?.!?…]$/.test(text)) text += '。'
if (!/[。!?.!?…]$/.test(text)) text += '。'
const id = options.id || 1
const fileName = `seg_${String(id).padStart(3, '0')}.mp3`