feat(video-pipeline): 重构多阶段生成管线并集成 CosyVoice TTS
- 重写 `phase-images`:改为并发 3 张并行生成,每个 item 完成立即写入 manifest,支持 MJ task ID 恢复 - 重写 `phase-videos`:先恢复已有 task ID 再提交新任务(并发 3),支持中断恢复 - 迁移 TTS 引擎:从 Qwen-TTS HTTP 接口切换为 CosyVoice WebSocket 接口,支持音色/语气参数透传 - 精简账号系统:移除 `styles/` 目录、`taskId` 过滤和 `--id` 正则校验,`references` 改为顶层字段 - 调整 `slugify`:限制中文字符 5 个、其他 10 个,避免文件名过长 - 更新文档:`manifest-schema.md` 中 `narration` 改为完整原文案,`account-creation.md` 新增 TTS 配置项 - 配置更新:默认 TTS 模型切换为 `cosyvoice-v3.5-plus`,新增 `localAudio` 参数
This commit is contained in:
@@ -12,7 +12,7 @@ const SCRIPTS_DIR = path.join(__dirname, '..')
|
||||
const SKILLS_DIR = path.join(SCRIPTS_DIR, '..')
|
||||
const PROJECT_ROOT = path.join(SKILLS_DIR, '..', '..')
|
||||
const CONFIG_PATH = path.join(SKILLS_DIR, 'config.json')
|
||||
const ACCOUNTS_DIR = path.join(PROJECT_ROOT, 'accounts')
|
||||
const ACCOUNTS_DIR = path.join(PROJECT_ROOT, '..', 'accounts')
|
||||
|
||||
// ============================================================================
|
||||
// 配置 & Manifest
|
||||
@@ -64,16 +64,14 @@ function getReferences(manifest, accountConfig) {
|
||||
log('images', 'manifest.references 全部无效,尝试 account fallback')
|
||||
}
|
||||
|
||||
// Fallback 1: 从 account.json 的 styles.*.references 读取
|
||||
const styles = accountConfig.styles || {}
|
||||
for (const [, style] of Object.entries(styles)) {
|
||||
for (const ref of (style.references || [])) {
|
||||
if (ref.url) result.urls.push(ref.url)
|
||||
if (ref.file && accountId) {
|
||||
const localPath = path.join(ACCOUNTS_DIR, accountId, 'references', ref.file)
|
||||
if (fs.existsSync(localPath)) {
|
||||
result.localPaths.push(localPath)
|
||||
}
|
||||
// Fallback 1: 从 account.json 的顶层 references 读取
|
||||
const topRefs = accountConfig.references || []
|
||||
for (const ref of topRefs) {
|
||||
if (ref.url) result.urls.push(ref.url)
|
||||
if (ref.file && accountId) {
|
||||
const localPath = path.join(ACCOUNTS_DIR, accountId, 'references', ref.file)
|
||||
if (fs.existsSync(localPath)) {
|
||||
result.localPaths.push(localPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,11 +109,26 @@ function ensureDir(dir) {
|
||||
}
|
||||
|
||||
function slugify(text) {
|
||||
return text
|
||||
.replace(/[^\w一-鿿]/g, '_')
|
||||
.replace(/_+/g, '_')
|
||||
.replace(/^_|_$/g, '')
|
||||
.substring(0, 20)
|
||||
// 限制中文字符最多5个,其他字符(英文数字)最多10个
|
||||
let chineseChars = []
|
||||
let otherChars = []
|
||||
|
||||
for (const char of text) {
|
||||
if (/\p{Script=Han}/u.test(char)) {
|
||||
// 中文字符
|
||||
if (chineseChars.length < 5) {
|
||||
chineseChars.push(char)
|
||||
}
|
||||
} else if (/\w/u.test(char)) {
|
||||
// 英文、数字
|
||||
if (otherChars.length < 10) {
|
||||
otherChars.push(char)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const result = chineseChars.concat(otherChars).join('')
|
||||
return result || 'untitled'
|
||||
}
|
||||
|
||||
function renameGeneratedFile(oldRelPath, dir, seq, nameHint, suffix) {
|
||||
|
||||
Reference in New Issue
Block a user