@biunow/agent-biutalk 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_shared/.tmp-panel-smoke/art/smoke.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/art-pipe/out/biuart-01_cave-mwq5kfpm.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/art-pipe/panel-delivery.json +7 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +7 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +68 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +17 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +43 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +1 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +533 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +93 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +3 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +6 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +10 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +15 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +116 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +168 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +59 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +235 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/stills/styleframe.jpg +0 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/fonts.sh +17 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +11 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +10 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +213 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +56 -0
- package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +5 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +7 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +68 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +8 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +17 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +43 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +1 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +533 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +93 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +93 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +94 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +3 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +6 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +10 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +15 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +116 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +168 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +59 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +235 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/stills/styleframe.jpg +0 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/fonts.sh +17 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +11 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +20 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +10 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +213 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +56 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +5 -0
- package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +2 -0
- package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +4 -0
- package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +1 -0
- package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +8 -0
- package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +4 -0
- package/_shared/.tmp-panel-smoke/vibe-pipe-ok/ep00-demo.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/vibe-pipe-ok/out/ep00-demo.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/vibe-pipe-ok/panel-delivery.json +7 -0
- package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +10 -0
- package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
- package/_shared/.tmp-panel-smoke/vibe-still.log +6 -0
- package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
- package/_shared/.tmp-panel-smoke/vibe-still2.log +26 -0
- package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
- package/_shared/lib/film-locate.mjs +203 -0
- package/_shared/lib/voice-catalog.mjs +127 -0
- package/_shared/scripts/apply-upload-limits.mjs +62 -0
- package/_shared/scripts/patch-film-hosts.mjs +233 -0
- package/_shared/scripts/patch-voice-options.mjs +41 -0
- package/_shared/scripts/sync-local-agents.mjs +67 -0
- package/_shared/scripts/wire-film-bridge.mjs +24 -0
- package/_shared/scripts/wire-voice-plus.mjs +68 -0
- package/_shared/studio/assert-panel-permit.mjs +67 -0
- package/_shared/studio/composer.css +559 -0
- package/_shared/studio/composer.js +728 -0
- package/_shared/studio/optimize-prompt.mjs +84 -0
- package/_shared/studio/optimize-prompt.test.mjs +47 -0
- package/_shared/studio/recipes.mjs +87 -0
- package/_shared/studio/select-menu.js +450 -0
- package/_shared/studio/to-english-prompt.mjs +165 -0
- package/_shared/studio/to-english-prompt.test.mjs +72 -0
- package/bin/server.js +22 -22
- package/data/looks.json +8 -0
- package/lib/film-bridge.mjs +1 -0
- package/lib/host.mjs +131 -264
- package/lib/voice-bridge.mjs +2 -0
- package/manifest.json +4 -3
- package/package.json +1 -1
- package/skills/biutalk/EXEC.md +69 -0
- package/skills/biutalk/SKILL.md +12 -10
- package/skills/biutalk/scripts/doctor.mjs +124 -0
- package/skills/biutalk/scripts/qc.mjs +129 -0
- package/skills/biutalk/scripts/scaffold.mjs +205 -0
- package/studio/app.js +16 -1
- package/studio/composer.css +94 -0
- package/studio/composer.js +257 -9
- package/studio/index.html +5 -1
- package/studio/to-english-prompt.mjs +16 -0
package/studio/composer.js
CHANGED
|
@@ -10,15 +10,36 @@
|
|
|
10
10
|
.replace(/"/g, '"');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// 本地 base64 JSON 上传:按类型分档(防呆,非云端配额)
|
|
14
|
+
const MB = 1024 * 1024;
|
|
15
|
+
const MAX_DOC_UPLOAD_BYTES = 50 * MB; // 图/文/PDF
|
|
16
|
+
const MAX_AUDIO_UPLOAD_BYTES = 100 * MB; // 音频
|
|
17
|
+
const MAX_VIDEO_UPLOAD_BYTES = 200 * MB; // 视频
|
|
18
|
+
const MAX_TOTAL_UPLOAD_BYTES = 250 * MB; // 单次任务合计
|
|
19
|
+
/** @deprecated 兼容旧引用:等同图文档上限 */
|
|
20
|
+
const MAX_UPLOAD_BYTES = MAX_DOC_UPLOAD_BYTES;
|
|
21
|
+
|
|
22
|
+
function uploadKind(file) {
|
|
23
|
+
const name = String(file?.name || '');
|
|
24
|
+
const type = String(file?.type || '');
|
|
25
|
+
if (type.startsWith('video/') || /\.(mp4|mov|webm|m4v)$/i.test(name)) return 'video';
|
|
26
|
+
if (type.startsWith('audio/') || /\.(mp3|wav|m4a|aac|flac|ogg)$/i.test(name)) return 'audio';
|
|
27
|
+
return 'doc';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function uploadCap(kind) {
|
|
31
|
+
if (kind === 'video') return { bytes: MAX_VIDEO_UPLOAD_BYTES, label: '200MB', title: '视频' };
|
|
32
|
+
if (kind === 'audio') return { bytes: MAX_AUDIO_UPLOAD_BYTES, label: '100MB', title: '音频' };
|
|
33
|
+
return { bytes: MAX_DOC_UPLOAD_BYTES, label: '50MB', title: '图文/PDF' };
|
|
34
|
+
}
|
|
14
35
|
|
|
15
36
|
async function api(path, opts) {
|
|
16
37
|
const res = await fetch(path, opts);
|
|
17
38
|
const data = await res.json().catch(() => ({}));
|
|
18
39
|
if (!res.ok) {
|
|
19
40
|
const raw = data.error || res.statusText || '请求失败';
|
|
20
|
-
if (res.status === 413 || /body too large
|
|
21
|
-
throw new Error('
|
|
41
|
+
if (res.status === 413 || /body too large|附件过大/i.test(raw)) {
|
|
42
|
+
throw new Error('附件过大:图文/PDF≤50MB,音频≤100MB,视频≤200MB,合计≤250MB');
|
|
22
43
|
}
|
|
23
44
|
throw new Error(raw);
|
|
24
45
|
}
|
|
@@ -28,9 +49,11 @@
|
|
|
28
49
|
function uploadBlockReason(file, usedBytes) {
|
|
29
50
|
const name = file?.name || '附件';
|
|
30
51
|
const size = Number(file?.size) || 0;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
52
|
+
const kind = uploadKind(file);
|
|
53
|
+
const { bytes: cap, label, title } = uploadCap(kind);
|
|
54
|
+
if (size > cap) return `${name} 超过 ${label}(${title}),请压缩后再上传`;
|
|
55
|
+
if ((Number(usedBytes) || 0) + size > MAX_TOTAL_UPLOAD_BYTES) {
|
|
56
|
+
return `附件合计超过 250MB,${name} 未加入`;
|
|
34
57
|
}
|
|
35
58
|
return '';
|
|
36
59
|
}
|
|
@@ -90,6 +113,126 @@
|
|
|
90
113
|
return '/api/jobs/' + encodeURIComponent(id) + '/film';
|
|
91
114
|
}
|
|
92
115
|
|
|
116
|
+
let jobDetailTimer = null;
|
|
117
|
+
|
|
118
|
+
function ensureJobDetailModal() {
|
|
119
|
+
let back = document.querySelector('.job-detail-modal');
|
|
120
|
+
if (back) return back;
|
|
121
|
+
back = document.createElement('div');
|
|
122
|
+
back.className = 'job-detail-modal film-modal';
|
|
123
|
+
back.hidden = true;
|
|
124
|
+
back.innerHTML = `
|
|
125
|
+
<div class="film-modal-card job-detail-card" role="dialog" aria-modal="true">
|
|
126
|
+
<div class="film-modal-bar">
|
|
127
|
+
<strong class="jd-title">任务详情</strong>
|
|
128
|
+
<button type="button" class="film-modal-x jd-close" aria-label="关闭">×</button>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="job-detail-body">
|
|
131
|
+
<div class="jd-badge"></div>
|
|
132
|
+
<div class="jd-msg"></div>
|
|
133
|
+
<div class="bar jd-bar"><i></i></div>
|
|
134
|
+
<div class="jd-meta muted"></div>
|
|
135
|
+
<div class="jd-follow" hidden>
|
|
136
|
+
<p class="muted jd-follow-hint">成片二次修改在 DSH 执行;这里只发起对应对话。</p>
|
|
137
|
+
<div class="jd-follow-actions"></div>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="jd-actions">
|
|
140
|
+
<button type="button" class="jd-refresh">刷新</button>
|
|
141
|
+
<button type="button" class="jd-dsh" hidden>在 DSH 打开对话</button>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>`;
|
|
145
|
+
document.body.appendChild(back);
|
|
146
|
+
const close = () => {
|
|
147
|
+
back.hidden = true;
|
|
148
|
+
if (jobDetailTimer) {
|
|
149
|
+
clearInterval(jobDetailTimer);
|
|
150
|
+
jobDetailTimer = null;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
back.querySelector('.jd-close').addEventListener('click', close);
|
|
154
|
+
back.addEventListener('click', (e) => { if (e.target === back) close(); });
|
|
155
|
+
document.addEventListener('keydown', (e) => {
|
|
156
|
+
if (e.key === 'Escape' && !back.hidden) close();
|
|
157
|
+
});
|
|
158
|
+
return back;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const FOLLOWUP_ACTIONS = [
|
|
162
|
+
{ id: 'narration', label: '改旁白', prompt: '请基于当前成片修改旁白文案,保持画幅与风格不变。' },
|
|
163
|
+
{ id: 'voice', label: '换音色', prompt: '请按 brief.json 里的 voice / ttsVoice 重新配音并重渲染成片。' },
|
|
164
|
+
{ id: 'subtitle', label: '加字幕', prompt: '请为当前成片补齐字幕并输出新成片。' },
|
|
165
|
+
{ id: 'rerender', label: '重渲染', prompt: '请在不改创意的前提下重新渲染成片,交付新的 MP4 路径。' },
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
function openDshSession(job, followPrompt) {
|
|
169
|
+
const sessionId = String(job.dshSessionId || '').trim();
|
|
170
|
+
if (!sessionId) {
|
|
171
|
+
window.alert('还没有 DSH 会话,请等创作接通后再试');
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
window.parent.postMessage({
|
|
175
|
+
source: 'bn-studio',
|
|
176
|
+
type: 'open-session',
|
|
177
|
+
sessionId,
|
|
178
|
+
...(followPrompt ? { draft: followPrompt } : {}),
|
|
179
|
+
}, '*');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function fillJobDetail(back, job) {
|
|
183
|
+
if (!back || !job) return;
|
|
184
|
+
const phase = phaseLabel(job);
|
|
185
|
+
back.querySelector('.jd-title').textContent = job.title || job.kind || '任务详情';
|
|
186
|
+
const badge = back.querySelector('.jd-badge');
|
|
187
|
+
badge.className = 'jd-badge badge ' + (phase.cls || '');
|
|
188
|
+
badge.textContent = phase.text + (job.progress != null ? ` · ${Number(job.progress) || 0}%` : '');
|
|
189
|
+
back.querySelector('.jd-msg').textContent = job.message || '暂无进度说明';
|
|
190
|
+
back.querySelector('.jd-bar i').style.width = `${Number(job.progress) || 0}%`;
|
|
191
|
+
const bits = [
|
|
192
|
+
job.screen ? `画幅 ${job.screen}` : '',
|
|
193
|
+
job.styleName || job.styleId || '',
|
|
194
|
+
job.voice && (job.voice.voiceName || job.voice.voiceId)
|
|
195
|
+
? `音色 ${job.voice.voiceName || job.voice.voiceId}`
|
|
196
|
+
: '',
|
|
197
|
+
].filter(Boolean);
|
|
198
|
+
back.querySelector('.jd-meta').textContent = bits.join(' · ');
|
|
199
|
+
const dshBtn = back.querySelector('.jd-dsh');
|
|
200
|
+
const sessionId = String(job.dshSessionId || '').trim();
|
|
201
|
+
dshBtn.hidden = !sessionId;
|
|
202
|
+
dshBtn.onclick = () => openDshSession(job);
|
|
203
|
+
const follow = back.querySelector('.jd-follow');
|
|
204
|
+
const followBox = back.querySelector('.jd-follow-actions');
|
|
205
|
+
const done = Boolean(job.outputMp4) || job.status === 'done' || job.phase === 'ready';
|
|
206
|
+
follow.hidden = !done || !sessionId;
|
|
207
|
+
followBox.innerHTML = '';
|
|
208
|
+
if (!follow.hidden) {
|
|
209
|
+
FOLLOWUP_ACTIONS.forEach((act) => {
|
|
210
|
+
const btn = document.createElement('button');
|
|
211
|
+
btn.type = 'button';
|
|
212
|
+
btn.className = 'jd-follow-btn';
|
|
213
|
+
btn.textContent = act.label;
|
|
214
|
+
btn.onclick = () => openDshSession(job, act.prompt);
|
|
215
|
+
followBox.appendChild(btn);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function openJobDetailModal(job) {
|
|
221
|
+
const back = ensureJobDetailModal();
|
|
222
|
+
fillJobDetail(back, job);
|
|
223
|
+
back.hidden = false;
|
|
224
|
+
const refresh = back.querySelector('.jd-refresh');
|
|
225
|
+
refresh.onclick = () => {
|
|
226
|
+
void api('/api/jobs/' + encodeURIComponent(job.id))
|
|
227
|
+
.then((data) => fillJobDetail(back, data.job || job))
|
|
228
|
+
.catch(() => {});
|
|
229
|
+
};
|
|
230
|
+
if (jobDetailTimer) clearInterval(jobDetailTimer);
|
|
231
|
+
if (job.status === 'running' || job.phase === 'dsh' || job.phase === 'inpanel') {
|
|
232
|
+
jobDetailTimer = setInterval(() => refresh.click(), 4000);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
93
236
|
function ensureFilmModal() {
|
|
94
237
|
let back = document.querySelector('.film-modal');
|
|
95
238
|
if (back) return back;
|
|
@@ -220,7 +363,7 @@
|
|
|
220
363
|
<span class="badge ${phase.cls}">${esc(phase.text)}</span>
|
|
221
364
|
${meta ? `<span class="job-chip">${esc(meta)}</span>` : ''}
|
|
222
365
|
<span class="job-actions">
|
|
223
|
-
<button type="button" class="job-open"
|
|
366
|
+
<button type="button" class="job-open" title="查看任务进度">任务详情</button>
|
|
224
367
|
<button type="button" class="job-del" title="从列表删除" aria-label="删除">×</button>
|
|
225
368
|
</span>
|
|
226
369
|
</div>
|
|
@@ -228,11 +371,11 @@
|
|
|
228
371
|
<div class="m">${esc(j.message || '')}</div>
|
|
229
372
|
<div class="bar"><i style="width:${Number(j.progress) || 0}%"></i></div>`;
|
|
230
373
|
const openBtn = el.querySelector('.job-open');
|
|
231
|
-
if (openBtn
|
|
374
|
+
if (openBtn) {
|
|
232
375
|
openBtn.addEventListener('click', (e) => {
|
|
233
376
|
e.preventDefault();
|
|
234
377
|
e.stopPropagation();
|
|
235
|
-
|
|
378
|
+
openJobDetailModal(j);
|
|
236
379
|
});
|
|
237
380
|
}
|
|
238
381
|
el.addEventListener('click', () => {
|
|
@@ -335,12 +478,115 @@
|
|
|
335
478
|
return (line || fallback || '未命名成片').slice(0, 120);
|
|
336
479
|
}
|
|
337
480
|
|
|
481
|
+
async function openVoicePicker(state, onPicked) {
|
|
482
|
+
const data = await api('/api/voice-options').catch(() => null);
|
|
483
|
+
const channels = (data && data.channels) || [];
|
|
484
|
+
if (!channels.length) throw new Error('语音目录不可用,请先在面板设置里配置语音');
|
|
485
|
+
if (!global.SelectMenu || typeof global.SelectMenu.mount !== 'function') {
|
|
486
|
+
throw new Error('下拉组件未加载');
|
|
487
|
+
}
|
|
488
|
+
const back = document.createElement('div');
|
|
489
|
+
back.className = 'film-modal voice-picker-modal';
|
|
490
|
+
back.innerHTML = `
|
|
491
|
+
<div class="film-modal-card job-detail-card" role="dialog" aria-modal="true">
|
|
492
|
+
<div class="film-modal-bar">
|
|
493
|
+
<strong>选择语音</strong>
|
|
494
|
+
<button type="button" class="film-modal-x" aria-label="关闭">×</button>
|
|
495
|
+
</div>
|
|
496
|
+
<div class="job-detail-body">
|
|
497
|
+
<label class="vp-field"><span>通道</span><div class="vp-channel"></div></label>
|
|
498
|
+
<label class="vp-field"><span>音色</span><div class="vp-voice"></div></label>
|
|
499
|
+
<p class="muted vp-hint"></p>
|
|
500
|
+
<div class="jd-actions">
|
|
501
|
+
<button type="button" class="jd-refresh vp-clear">清除选择</button>
|
|
502
|
+
<button type="button" class="primary vp-ok">确定</button>
|
|
503
|
+
</div>
|
|
504
|
+
</div>
|
|
505
|
+
</div>`;
|
|
506
|
+
document.body.appendChild(back);
|
|
507
|
+
const hint = back.querySelector('.vp-hint');
|
|
508
|
+
const current = state.voice || {};
|
|
509
|
+
let channelId = current.channel || (channels.find((c) => c.enabled) || channels[0] || {}).id || '';
|
|
510
|
+
let voiceId = current.voiceId || '';
|
|
511
|
+
const channelHost = back.querySelector('.vp-channel');
|
|
512
|
+
const voiceHost = back.querySelector('.vp-voice');
|
|
513
|
+
const channelMenu = global.SelectMenu.mount(channelHost, {
|
|
514
|
+
size: 'md',
|
|
515
|
+
value: channelId,
|
|
516
|
+
options: channels.map((ch) => ({
|
|
517
|
+
value: ch.id,
|
|
518
|
+
label: ch.label + (ch.enabled ? '' : '(未配置)'),
|
|
519
|
+
})),
|
|
520
|
+
onChange: (v) => {
|
|
521
|
+
channelId = v;
|
|
522
|
+
fillVoices(true);
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
let voiceMenu = null;
|
|
526
|
+
const fillVoices = (reset) => {
|
|
527
|
+
const ch = channels.find((c) => c.id === channelId);
|
|
528
|
+
hint.textContent = (ch && ch.hint) || '';
|
|
529
|
+
const opts = (ch && ch.voices ? ch.voices : []).map((v) => ({
|
|
530
|
+
value: v.id,
|
|
531
|
+
label: v.label || v.name || v.id,
|
|
532
|
+
}));
|
|
533
|
+
if (reset || !opts.some((o) => o.value === voiceId)) {
|
|
534
|
+
voiceId = (opts.some((o) => o.value === current.voiceId) && !reset)
|
|
535
|
+
? current.voiceId
|
|
536
|
+
: (ch && ch.defaultVoiceId && opts.some((o) => o.value === ch.defaultVoiceId)
|
|
537
|
+
? ch.defaultVoiceId
|
|
538
|
+
: (opts[0] && opts[0].value) || '');
|
|
539
|
+
}
|
|
540
|
+
voiceHost.innerHTML = '';
|
|
541
|
+
voiceMenu = global.SelectMenu.mount(voiceHost, {
|
|
542
|
+
size: 'md',
|
|
543
|
+
value: voiceId,
|
|
544
|
+
options: opts.length ? opts : [{ value: '', label: '暂无音色' }],
|
|
545
|
+
onChange: (v) => { voiceId = v; },
|
|
546
|
+
});
|
|
547
|
+
channelMenu.setValue(channelId, true);
|
|
548
|
+
};
|
|
549
|
+
fillVoices(false);
|
|
550
|
+
const close = () => back.remove();
|
|
551
|
+
back.querySelector('.film-modal-x').onclick = close;
|
|
552
|
+
back.addEventListener('click', (e) => { if (e.target === back) close(); });
|
|
553
|
+
back.querySelector('.vp-clear').onclick = () => {
|
|
554
|
+
state.voice = null;
|
|
555
|
+
if (onPicked) onPicked(null);
|
|
556
|
+
close();
|
|
557
|
+
};
|
|
558
|
+
back.querySelector('.vp-ok').onclick = () => {
|
|
559
|
+
const ch = channels.find((c) => c.id === channelId);
|
|
560
|
+
const v = (ch && ch.voices || []).find((x) => x.id === voiceId);
|
|
561
|
+
if (!v) {
|
|
562
|
+
window.alert('请选择可用音色');
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
state.voice = {
|
|
566
|
+
channel: ch.id,
|
|
567
|
+
voiceId: v.id,
|
|
568
|
+
voiceName: v.name || v.label || v.id,
|
|
569
|
+
rate: ch.rate || 0,
|
|
570
|
+
provider: ch.provider || '',
|
|
571
|
+
engine: ch.engine || '',
|
|
572
|
+
};
|
|
573
|
+
if (onPicked) onPicked(state.voice);
|
|
574
|
+
close();
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
|
|
338
578
|
global.Composer = {
|
|
339
579
|
esc,
|
|
340
580
|
api,
|
|
341
581
|
fileToBase64,
|
|
342
582
|
uploadBlockReason,
|
|
343
583
|
MAX_UPLOAD_BYTES,
|
|
584
|
+
MAX_DOC_UPLOAD_BYTES,
|
|
585
|
+
MAX_AUDIO_UPLOAD_BYTES,
|
|
586
|
+
MAX_VIDEO_UPLOAD_BYTES,
|
|
587
|
+
MAX_TOTAL_UPLOAD_BYTES,
|
|
588
|
+
uploadKind,
|
|
589
|
+
uploadCap,
|
|
344
590
|
phaseLabel,
|
|
345
591
|
bindPlusMenu,
|
|
346
592
|
bindCount,
|
|
@@ -349,6 +595,8 @@
|
|
|
349
595
|
titleFromPrompt,
|
|
350
596
|
paintRecipe,
|
|
351
597
|
claimCasePrompt,
|
|
598
|
+
openJobDetailModal,
|
|
599
|
+
openVoicePicker,
|
|
352
600
|
};
|
|
353
601
|
|
|
354
602
|
let casePromptText = '';
|
package/studio/index.html
CHANGED
|
@@ -47,7 +47,11 @@
|
|
|
47
47
|
<span class="plus-ico">↑</span>
|
|
48
48
|
<span><strong>上传附件</strong><small>图片 / 视频 / 音频 / 文档</small></span>
|
|
49
49
|
</button>
|
|
50
|
-
|
|
50
|
+
<button type="button" id="voiceBtn">
|
|
51
|
+
<span class="plus-ico">♪</span>
|
|
52
|
+
<span><strong>选择语音</strong><small>免费 / API / 复刻音色</small></span>
|
|
53
|
+
</button>
|
|
54
|
+
<button type="button" id="paceToggle">
|
|
51
55
|
<span class="plus-ico">⏱</span>
|
|
52
56
|
<span><strong>节奏</strong><small id="paceHint">1.0×</small></span>
|
|
53
57
|
</button>
|
|
@@ -134,6 +134,22 @@ export async function toEnglishPrompt(text, fetchImpl = globalThis.fetch) {
|
|
|
134
134
|
const source = String(text || '').trim();
|
|
135
135
|
if (!source) return '';
|
|
136
136
|
if (!/[\u4e00-\u9fff]/.test(source)) return source;
|
|
137
|
+
|
|
138
|
+
// Prefer BN panel LLM settings when injected (PANEL_LLM_*).
|
|
139
|
+
// This file may live in products/_shared/studio or products/<agent>/studio.
|
|
140
|
+
try {
|
|
141
|
+
let panelTranslateToEnglish;
|
|
142
|
+
try {
|
|
143
|
+
({ panelTranslateToEnglish } = await import('../lib/panel-llm.mjs'));
|
|
144
|
+
} catch {
|
|
145
|
+
({ panelTranslateToEnglish } = await import('../_shared/lib/panel-llm.mjs'));
|
|
146
|
+
}
|
|
147
|
+
const viaPanel = await panelTranslateToEnglish(source, fetchImpl);
|
|
148
|
+
if (viaPanel) return enforceFlags(source, polishEnglish(viaPanel));
|
|
149
|
+
} catch {
|
|
150
|
+
/* fall through to MyMemory */
|
|
151
|
+
}
|
|
152
|
+
|
|
137
153
|
const framed = source.match(/^用([\s\S]{1,40}?)讲「([^」]+)」\s*[。.]?\s*([\s\S]*)$/);
|
|
138
154
|
if (framed) {
|
|
139
155
|
const topicEn = (await translatePiece(framed[2], fetchImpl)).replace(/[.。\s]+$/g, '');
|