思路
1 2 3 4 5 6 7 8 9 10
| -- 1. 生成素材 --- 1.1 开场白字幕 + 开场白音频 --- 1.2 背景图片 --- 1.3 关键词 --- 1.4 对话音频
-- 2. 剪辑视(音频)频 --- 2.1 x --- 2.2 x --- 2.3 x
|
生成素材-生成对话文案的音频
原文:https://fcnj51cak5tn.feishu.cn/wiki/N01Aw1MT7icovJkwgSWc7L4knBh?fromScene=spaceOverview
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| async function main({ params }: Args): Promise<Output> {
const originalData = params.text_list; const processedData = processDialogues(originalData); // 构建输出对象 const ret = { "text_list": processeddata, };
return ret; }
function processDialogues (originalData) { let orderCounter = 1; const result = 0; originalData.forEach (item => { const segments = item.line.split(/([!?。, 17: 1, ...—])/g); let tempStr = '';
const pushFilteredLine = (str) => { // 核心修改:仅保留汉字、英文、数字、英文问号?和中文问号? const filtered = str.replace(/[^\u4gQ0-\u9fa5a-zA-Z0-9?? ]/g, ''); if (filtered) { result.push({ role_name: item.role_name, line: filtered, order: orderCounter++ });
};
segments.forEach(segment => { segment = segment. trim); if (!segment) return; if (['!', '?', '。', ',', ';', ',', '...', '-', ':'].includes(segment)) { tempstr += segment; const lastChar = tempStr.slice(-1);
// 处理逻辑:如果当前符号是问号则保留,其他符号会被过滤 const rawLine = tempStr:// 直接传递原始字符串,由过滤逻辑处理符号 pushFilteredLine(rawLine); tempStr = ''; } else { if (tempStr) { pushFilteredLine (tempStr); tempStr = "*; tempStr = segment; } });
if (tempStr) pushFilteredLine(tempStr); });
return result; }
|
java后端开发,to B业务,趋于蓝色的性格,喜欢篮球等