@biunow/agent-biutalk 2.0.0 → 2.0.2
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/lib/panel-llm.mjs +82 -0
- package/_shared/lib/panel-settings.mjs +16 -0
- package/_shared/scripts/.logs/2026-11-27T15-12-16-216Z.log +401 -0
- package/_shared/scripts/run-quiet.mjs +66 -0
- package/_shared/scripts/stage.mjs +105 -0
- package/_shared/studio/composer.css +55 -45
- package/_shared/studio/composer.js +198 -103
- package/bin/server.js +59 -6
- package/manifest.json +3 -3
- package/package.json +1 -1
- package/skills/biutalk/EXEC.md +29 -6
- package/skills/biutalk/SKILL.md +4 -0
- package/skills/biutalk/scripts/run-quiet.mjs +66 -0
- package/skills/biutalk/scripts/stage.mjs +105 -0
- package/skills/biutalk/scripts/stages.json +31 -0
- package/studio/app.js +45 -11
- package/studio/composer.css +55 -45
- package/studio/composer.js +198 -103
- package/studio/index.html +4 -4
- 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 +0 -7
- package/_shared/.tmp-panel-smoke/reel-pipe/film/index.html +0 -7
- package/_shared/.tmp-panel-smoke/reel-pipe/film/main.js +0 -68
- package/_shared/.tmp-panel-smoke/reel-pipe/film/panel-beats.json +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/CREDITS +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/build.sh +0 -17
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/ease.js +0 -43
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/events.json +0 -1
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/film.js +0 -533
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-Archivo.txt +0 -93
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/fonts/fonts.css +0 -3
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/index.html +0 -6
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/lines.json +0 -10
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/main.js +0 -15
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/mix.py +0 -116
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score.py +0 -168
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/music/score_meta.json +0 -59
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/score.json +0 -235
- 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 +0 -17
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/subs.py +0 -11
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/tools/words.py +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/dur.json +0 -10
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words.json +0 -213
- package/_shared/.tmp-panel-smoke/reel-pipe/style-demo/voices/words_rel.json +0 -56
- package/_shared/.tmp-panel-smoke/reel-pipe/style-ref.json +0 -5
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/index.html +0 -7
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/main.js +0 -68
- package/_shared/.tmp-panel-smoke/reel-pipe2/film/panel-beats.json +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe2/out/video.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/reel-pipe2/panel-delivery.json +0 -8
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/CREDITS +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/build.sh +0 -17
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/ease.js +0 -43
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/events.json +0 -1
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/film.js +0 -533
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-Archivo.txt +0 -93
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-DMSerifDisplay.txt +0 -93
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/OFL-UnifrakturMaguntia.txt +0 -94
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/fonts/fonts.css +0 -3
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/index.html +0 -6
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/lines.json +0 -10
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/main.js +0 -15
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/mix.py +0 -116
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score.py +0 -168
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/music/score_meta.json +0 -59
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/score.json +0 -235
- 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 +0 -17
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/subs.py +0 -11
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/tools/words.py +0 -20
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/dur.json +0 -10
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words.json +0 -213
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-demo/voices/words_rel.json +0 -56
- package/_shared/.tmp-panel-smoke/reel-pipe2/style-ref.json +0 -5
- package/_shared/.tmp-panel-smoke/remo-pipe/brief.md +0 -2
- package/_shared/.tmp-panel-smoke/remo-pipe/remo-job.json +0 -4
- package/_shared/.tmp-panel-smoke/remo-pipe2/brief.md +0 -1
- package/_shared/.tmp-panel-smoke/remo-pipe2/out/final.mp4 +0 -0
- package/_shared/.tmp-panel-smoke/remo-pipe2/panel-delivery.json +0 -8
- package/_shared/.tmp-panel-smoke/remo-pipe2/remo-job.json +0 -4
- 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 +0 -7
- package/_shared/.tmp-panel-smoke/vibe-pipe-ok/publish.json +0 -10
- package/_shared/.tmp-panel-smoke/vibe-still.jpg +0 -0
- package/_shared/.tmp-panel-smoke/vibe-still.log +0 -6
- package/_shared/.tmp-panel-smoke/vibe-still.log.err +0 -0
- package/_shared/.tmp-panel-smoke/vibe-still2.log +0 -26
- package/_shared/.tmp-panel-smoke/vibe-still2.log.err +0 -0
package/studio/composer.js
CHANGED
|
@@ -106,6 +106,97 @@
|
|
|
106
106
|
sync();
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/** 附件的角色标签:所有 Studio 共用一套名字,避免五个面板各叫各的。 */
|
|
110
|
+
const ROLE_LABEL = {
|
|
111
|
+
ref: '参考',
|
|
112
|
+
media: '素材',
|
|
113
|
+
character: '人物',
|
|
114
|
+
voice: '口播',
|
|
115
|
+
music: '配乐',
|
|
116
|
+
doc: '文档',
|
|
117
|
+
script: '文稿',
|
|
118
|
+
lyrics: '歌词',
|
|
119
|
+
subtitle: '字幕',
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function roleLabel(role) {
|
|
123
|
+
return ROLE_LABEL[role] || '';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let openRoleMenu = null;
|
|
127
|
+
|
|
128
|
+
/** + 菜单里的二级“附件角色”菜单(参考素材 / 口播录音 / 配乐 / 文稿 …)。 */
|
|
129
|
+
function bindRoleMenu(anchor, items, onPick) {
|
|
130
|
+
if (openRoleMenu) {
|
|
131
|
+
openRoleMenu.close();
|
|
132
|
+
openRoleMenu = null;
|
|
133
|
+
}
|
|
134
|
+
if (!items || !items.length) return null;
|
|
135
|
+
const menu = document.createElement('div');
|
|
136
|
+
menu.className = 'plus-menu role-menu';
|
|
137
|
+
items.forEach((item) => {
|
|
138
|
+
const btn = document.createElement('button');
|
|
139
|
+
btn.type = 'button';
|
|
140
|
+
btn.innerHTML =
|
|
141
|
+
`<span class="plus-ico">${esc(item.icon || '·')}</span>` +
|
|
142
|
+
`<span><strong>${esc(item.label)}</strong><small>${esc(item.hint || '')}</small></span>`;
|
|
143
|
+
btn.addEventListener('click', (e) => {
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
e.stopPropagation();
|
|
146
|
+
close();
|
|
147
|
+
onPick(item);
|
|
148
|
+
});
|
|
149
|
+
menu.appendChild(btn);
|
|
150
|
+
});
|
|
151
|
+
document.body.appendChild(menu);
|
|
152
|
+
const rect = anchor.getBoundingClientRect();
|
|
153
|
+
const width = 260;
|
|
154
|
+
const left = Math.min(rect.right + 8, Math.max(8, window.innerWidth - width - 8));
|
|
155
|
+
const top = Math.min(Math.max(8, rect.top - 6), Math.max(8, window.innerHeight - menu.offsetHeight - 8));
|
|
156
|
+
menu.style.position = 'fixed';
|
|
157
|
+
menu.style.left = `${left}px`;
|
|
158
|
+
menu.style.top = `${top}px`;
|
|
159
|
+
menu.style.width = `${width}px`;
|
|
160
|
+
const close = () => {
|
|
161
|
+
menu.remove();
|
|
162
|
+
document.removeEventListener('click', onDocClick);
|
|
163
|
+
document.removeEventListener('keydown', onKey);
|
|
164
|
+
openRoleMenu = null;
|
|
165
|
+
};
|
|
166
|
+
const onDocClick = () => close();
|
|
167
|
+
const onKey = (e) => {
|
|
168
|
+
if (e.key === 'Escape') close();
|
|
169
|
+
};
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
document.addEventListener('click', onDocClick);
|
|
172
|
+
document.addEventListener('keydown', onKey);
|
|
173
|
+
}, 0);
|
|
174
|
+
openRoleMenu = { close };
|
|
175
|
+
return openRoleMenu;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 按角色取文件:设置 accept → 弹选择框 → 回传 { role, files }。 */
|
|
179
|
+
function pickFilesByRole(input, role, accept, onPicked) {
|
|
180
|
+
if (!input) return;
|
|
181
|
+
if (input.__roleHandler) {
|
|
182
|
+
input.removeEventListener('change', input.__roleHandler);
|
|
183
|
+
input.__roleHandler = null;
|
|
184
|
+
}
|
|
185
|
+
if (accept) input.setAttribute('accept', accept);
|
|
186
|
+
else input.removeAttribute('accept');
|
|
187
|
+
input.dataset.role = role;
|
|
188
|
+
const handler = () => {
|
|
189
|
+
input.removeEventListener('change', handler);
|
|
190
|
+
input.__roleHandler = null;
|
|
191
|
+
const files = Array.from(input.files || []);
|
|
192
|
+
input.value = '';
|
|
193
|
+
if (files.length) onPicked(role, files);
|
|
194
|
+
};
|
|
195
|
+
input.__roleHandler = handler;
|
|
196
|
+
input.addEventListener('change', handler);
|
|
197
|
+
input.click();
|
|
198
|
+
}
|
|
199
|
+
|
|
109
200
|
let filmSelectedId = '';
|
|
110
201
|
let selectedJobId = '';
|
|
111
202
|
|
|
@@ -590,6 +681,10 @@
|
|
|
590
681
|
phaseLabel,
|
|
591
682
|
bindPlusMenu,
|
|
592
683
|
bindCount,
|
|
684
|
+
bindRoleMenu,
|
|
685
|
+
pickFilesByRole,
|
|
686
|
+
roleLabel,
|
|
687
|
+
ROLE_LABEL,
|
|
593
688
|
renderJobs,
|
|
594
689
|
addChip,
|
|
595
690
|
titleFromPrompt,
|
|
@@ -622,107 +717,107 @@
|
|
|
622
717
|
studioReadyForCase = true;
|
|
623
718
|
writeCasePrompt();
|
|
624
719
|
}
|
|
625
|
-
let currentRecipe = null;
|
|
626
|
-
|
|
627
|
-
let optimizeMember = false;
|
|
628
|
-
let optimizeTipTimer = 0;
|
|
629
|
-
|
|
630
|
-
function showOptimizeTip(message) {
|
|
631
|
-
const tip = document.getElementById('optimizeTip');
|
|
632
|
-
if (!tip) return;
|
|
633
|
-
tip.hidden = false;
|
|
634
|
-
tip.textContent = message;
|
|
635
|
-
window.clearTimeout(optimizeTipTimer);
|
|
636
|
-
optimizeTipTimer = window.setTimeout(() => {
|
|
637
|
-
tip.hidden = true;
|
|
638
|
-
}, 2600);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
async function onOptimizePrompt() {
|
|
642
|
-
const btn = document.getElementById('optimizeBtn');
|
|
643
|
-
const prompt = document.getElementById('prompt');
|
|
644
|
-
if (!btn || !prompt) return;
|
|
645
|
-
if (!optimizeMember) {
|
|
646
|
-
showOptimizeTip('会员专属,请先开通会员');
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
if (btn.dataset.busy === '1') return;
|
|
650
|
-
btn.dataset.busy = '1';
|
|
651
|
-
const previous = btn.textContent;
|
|
652
|
-
btn.textContent = '优化中';
|
|
653
|
-
try {
|
|
654
|
-
const recipe = currentRecipe || {};
|
|
655
|
-
const data = await api('/api/optimize-prompt', {
|
|
656
|
-
method: 'POST',
|
|
657
|
-
headers: { 'content-type': 'application/json' },
|
|
658
|
-
body: JSON.stringify({
|
|
659
|
-
text: prompt.value,
|
|
660
|
-
templatePrompt: recipe.prompt || '',
|
|
661
|
-
narration: recipe.narration || '',
|
|
662
|
-
attachment: recipe.attachment || '',
|
|
663
|
-
}),
|
|
664
|
-
});
|
|
665
|
-
const next = String((data && data.prompt) || '').trim();
|
|
666
|
-
if (!next) throw new Error('没有得到可用的提示词');
|
|
667
|
-
prompt.value = next;
|
|
668
|
-
prompt.dispatchEvent(new Event('input'));
|
|
669
|
-
if (data && data.kept) showOptimizeTip('没选模板,按你写的原文出片');
|
|
670
|
-
} catch (error) {
|
|
671
|
-
const message = (error && error.message) || '无法优化提示词';
|
|
672
|
-
if (message.indexOf('会员专属') >= 0) {
|
|
673
|
-
optimizeMember = false;
|
|
674
|
-
btn.classList.add('is-locked');
|
|
675
|
-
btn.setAttribute('aria-disabled', 'true');
|
|
676
|
-
showOptimizeTip('会员专属,请先开通会员');
|
|
677
|
-
} else {
|
|
678
|
-
const err = document.getElementById('err');
|
|
679
|
-
if (err) {
|
|
680
|
-
err.hidden = false;
|
|
681
|
-
err.textContent = message;
|
|
682
|
-
} else {
|
|
683
|
-
showOptimizeTip(message);
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
} finally {
|
|
687
|
-
btn.dataset.busy = '';
|
|
688
|
-
btn.textContent = previous || '优化提示词';
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
function mountOptimize() {
|
|
693
|
-
const prompt = document.getElementById('prompt');
|
|
694
|
-
if (!prompt || document.getElementById('optimizeBtn')) return;
|
|
695
|
-
const stage = document.createElement('div');
|
|
696
|
-
stage.className = 'prompt-stage';
|
|
697
|
-
prompt.parentNode.insertBefore(stage, prompt);
|
|
698
|
-
stage.appendChild(prompt);
|
|
699
|
-
const btn = document.createElement('button');
|
|
700
|
-
btn.type = 'button';
|
|
701
|
-
btn.id = 'optimizeBtn';
|
|
702
|
-
btn.className = 'optimize is-locked';
|
|
703
|
-
btn.setAttribute('aria-disabled', 'true');
|
|
704
|
-
btn.textContent = '优化提示词';
|
|
705
|
-
const tip = document.createElement('div');
|
|
706
|
-
tip.id = 'optimizeTip';
|
|
707
|
-
tip.className = 'optimize-tip';
|
|
708
|
-
tip.hidden = true;
|
|
709
|
-
stage.appendChild(btn);
|
|
710
|
-
stage.appendChild(tip);
|
|
711
|
-
btn.addEventListener('click', () => {
|
|
712
|
-
void onOptimizePrompt();
|
|
713
|
-
});
|
|
714
|
-
fetch('/api/health')
|
|
715
|
-
.then((res) => res.json())
|
|
716
|
-
.then((data) => {
|
|
717
|
-
optimizeMember = !!(data && data.member === true);
|
|
718
|
-
btn.classList.toggle('is-locked', !optimizeMember);
|
|
719
|
-
btn.setAttribute('aria-disabled', optimizeMember ? 'false' : 'true');
|
|
720
|
-
})
|
|
721
|
-
.catch(() => {
|
|
722
|
-
optimizeMember = false;
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
mountOptimize();
|
|
727
|
-
|
|
720
|
+
let currentRecipe = null;
|
|
721
|
+
|
|
722
|
+
let optimizeMember = false;
|
|
723
|
+
let optimizeTipTimer = 0;
|
|
724
|
+
|
|
725
|
+
function showOptimizeTip(message) {
|
|
726
|
+
const tip = document.getElementById('optimizeTip');
|
|
727
|
+
if (!tip) return;
|
|
728
|
+
tip.hidden = false;
|
|
729
|
+
tip.textContent = message;
|
|
730
|
+
window.clearTimeout(optimizeTipTimer);
|
|
731
|
+
optimizeTipTimer = window.setTimeout(() => {
|
|
732
|
+
tip.hidden = true;
|
|
733
|
+
}, 2600);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
async function onOptimizePrompt() {
|
|
737
|
+
const btn = document.getElementById('optimizeBtn');
|
|
738
|
+
const prompt = document.getElementById('prompt');
|
|
739
|
+
if (!btn || !prompt) return;
|
|
740
|
+
if (!optimizeMember) {
|
|
741
|
+
showOptimizeTip('会员专属,请先开通会员');
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (btn.dataset.busy === '1') return;
|
|
745
|
+
btn.dataset.busy = '1';
|
|
746
|
+
const previous = btn.textContent;
|
|
747
|
+
btn.textContent = '优化中';
|
|
748
|
+
try {
|
|
749
|
+
const recipe = currentRecipe || {};
|
|
750
|
+
const data = await api('/api/optimize-prompt', {
|
|
751
|
+
method: 'POST',
|
|
752
|
+
headers: { 'content-type': 'application/json' },
|
|
753
|
+
body: JSON.stringify({
|
|
754
|
+
text: prompt.value,
|
|
755
|
+
templatePrompt: recipe.prompt || '',
|
|
756
|
+
narration: recipe.narration || '',
|
|
757
|
+
attachment: recipe.attachment || '',
|
|
758
|
+
}),
|
|
759
|
+
});
|
|
760
|
+
const next = String((data && data.prompt) || '').trim();
|
|
761
|
+
if (!next) throw new Error('没有得到可用的提示词');
|
|
762
|
+
prompt.value = next;
|
|
763
|
+
prompt.dispatchEvent(new Event('input'));
|
|
764
|
+
if (data && data.kept) showOptimizeTip('没选模板,按你写的原文出片');
|
|
765
|
+
} catch (error) {
|
|
766
|
+
const message = (error && error.message) || '无法优化提示词';
|
|
767
|
+
if (message.indexOf('会员专属') >= 0) {
|
|
768
|
+
optimizeMember = false;
|
|
769
|
+
btn.classList.add('is-locked');
|
|
770
|
+
btn.setAttribute('aria-disabled', 'true');
|
|
771
|
+
showOptimizeTip('会员专属,请先开通会员');
|
|
772
|
+
} else {
|
|
773
|
+
const err = document.getElementById('err');
|
|
774
|
+
if (err) {
|
|
775
|
+
err.hidden = false;
|
|
776
|
+
err.textContent = message;
|
|
777
|
+
} else {
|
|
778
|
+
showOptimizeTip(message);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
} finally {
|
|
782
|
+
btn.dataset.busy = '';
|
|
783
|
+
btn.textContent = previous || '优化提示词';
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function mountOptimize() {
|
|
788
|
+
const prompt = document.getElementById('prompt');
|
|
789
|
+
if (!prompt || document.getElementById('optimizeBtn')) return;
|
|
790
|
+
const stage = document.createElement('div');
|
|
791
|
+
stage.className = 'prompt-stage';
|
|
792
|
+
prompt.parentNode.insertBefore(stage, prompt);
|
|
793
|
+
stage.appendChild(prompt);
|
|
794
|
+
const btn = document.createElement('button');
|
|
795
|
+
btn.type = 'button';
|
|
796
|
+
btn.id = 'optimizeBtn';
|
|
797
|
+
btn.className = 'optimize is-locked';
|
|
798
|
+
btn.setAttribute('aria-disabled', 'true');
|
|
799
|
+
btn.textContent = '优化提示词';
|
|
800
|
+
const tip = document.createElement('div');
|
|
801
|
+
tip.id = 'optimizeTip';
|
|
802
|
+
tip.className = 'optimize-tip';
|
|
803
|
+
tip.hidden = true;
|
|
804
|
+
stage.appendChild(btn);
|
|
805
|
+
stage.appendChild(tip);
|
|
806
|
+
btn.addEventListener('click', () => {
|
|
807
|
+
void onOptimizePrompt();
|
|
808
|
+
});
|
|
809
|
+
fetch('/api/health')
|
|
810
|
+
.then((res) => res.json())
|
|
811
|
+
.then((data) => {
|
|
812
|
+
optimizeMember = !!(data && data.member === true);
|
|
813
|
+
btn.classList.toggle('is-locked', !optimizeMember);
|
|
814
|
+
btn.setAttribute('aria-disabled', optimizeMember ? 'false' : 'true');
|
|
815
|
+
})
|
|
816
|
+
.catch(() => {
|
|
817
|
+
optimizeMember = false;
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
mountOptimize();
|
|
822
|
+
|
|
728
823
|
})(window);
|
package/studio/index.html
CHANGED
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
<div class="plus-menu" id="plusMenu" hidden>
|
|
46
46
|
<button type="button" id="uploadBtn">
|
|
47
47
|
<span class="plus-ico">↑</span>
|
|
48
|
-
<span><strong
|
|
48
|
+
<span><strong>上传素材</strong><small id="uploadHint">图片 / 视频 / 文档 / 口播 / 配乐</small></span>
|
|
49
49
|
</button>
|
|
50
|
-
|
|
50
|
+
<button type="button" id="voiceBtn">
|
|
51
51
|
<span class="plus-ico">♪</span>
|
|
52
52
|
<span><strong>选择语音</strong><small>免费 / API / 复刻音色</small></span>
|
|
53
53
|
</button>
|
|
54
|
-
<button type="button" id="paceToggle">
|
|
54
|
+
<button type="button" id="paceToggle">
|
|
55
55
|
<span class="plus-ico">⏱</span>
|
|
56
56
|
<span><strong>节奏</strong><small id="paceHint">1.0×</small></span>
|
|
57
57
|
</button>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<div class="assets" id="assets" hidden>
|
|
70
70
|
<span class="assets-label">素材</span>
|
|
71
71
|
</div>
|
|
72
|
-
<input id="files" class="file-hidden" type="file" multiple
|
|
72
|
+
<input id="files" class="file-hidden" type="file" multiple />
|
|
73
73
|
<p class="err" id="err" hidden></p>
|
|
74
74
|
</section>
|
|
75
75
|
|
|
Binary file
|
|
Binary file
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html><head><meta charset="utf-8"><title>测试</title>
|
|
3
|
-
<style>html,body{margin:0;background:#0a0a0c;overflow:hidden}canvas{display:block}</style>
|
|
4
|
-
</head><body>
|
|
5
|
-
<canvas id="c" width="960" height="540"></canvas>
|
|
6
|
-
<script type="module" src="./main.js"></script>
|
|
7
|
-
</body></html>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Panel kinetic film — rendered by lemo core/render/video.mjs
|
|
2
|
-
const W = 960, H = 540;
|
|
3
|
-
const BEATS = [
|
|
4
|
-
{
|
|
5
|
-
"id": "hook",
|
|
6
|
-
"headline": "测试",
|
|
7
|
-
"caption": "",
|
|
8
|
-
"durationSec": 3
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"id": "body",
|
|
12
|
-
"headline": "Key point",
|
|
13
|
-
"caption": "一句话",
|
|
14
|
-
"durationSec": 5
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"id": "cta",
|
|
18
|
-
"headline": "Next step",
|
|
19
|
-
"caption": "",
|
|
20
|
-
"durationSec": 3
|
|
21
|
-
}
|
|
22
|
-
];
|
|
23
|
-
const DUR = 11;
|
|
24
|
-
window.DUR = DUR;
|
|
25
|
-
const cv = document.getElementById('c');
|
|
26
|
-
const g = cv.getContext('2d');
|
|
27
|
-
const RED = '#e11d48', FG = '#f4f4f5', BG = '#0a0a0c', MUTE = '#a1a1aa';
|
|
28
|
-
|
|
29
|
-
function ease(t) { return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2; }
|
|
30
|
-
|
|
31
|
-
function beatAt(t) {
|
|
32
|
-
let acc = 0;
|
|
33
|
-
for (const b of BEATS) {
|
|
34
|
-
if (t < acc + b.durationSec) return { b, local: t - acc, p: (t - acc) / b.durationSec };
|
|
35
|
-
acc += b.durationSec;
|
|
36
|
-
}
|
|
37
|
-
const last = BEATS[BEATS.length - 1];
|
|
38
|
-
return { b: last, local: last.durationSec, p: 1 };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
window.render = function render(t) {
|
|
42
|
-
const { b, p } = beatAt(Math.max(0, Math.min(DUR - 0.001, t)));
|
|
43
|
-
const a = ease(Math.min(1, p * 3));
|
|
44
|
-
g.fillStyle = BG;
|
|
45
|
-
g.fillRect(0, 0, W, H);
|
|
46
|
-
g.fillStyle = RED;
|
|
47
|
-
g.fillRect(0, 0, Math.max(4, W * 0.012), H);
|
|
48
|
-
g.save();
|
|
49
|
-
g.globalAlpha = 0.15 + 0.85 * a;
|
|
50
|
-
g.fillStyle = FG;
|
|
51
|
-
g.font = '700 ' + Math.round(H * 0.08) + 'px system-ui, sans-serif';
|
|
52
|
-
g.textBaseline = 'middle';
|
|
53
|
-
const hx = W * 0.08;
|
|
54
|
-
const hy = H * 0.42;
|
|
55
|
-
g.fillText(b.headline, hx, hy);
|
|
56
|
-
if (b.caption) {
|
|
57
|
-
g.fillStyle = MUTE;
|
|
58
|
-
g.font = '500 ' + Math.round(H * 0.035) + 'px system-ui, sans-serif';
|
|
59
|
-
g.fillText(b.caption, hx, hy + H * 0.1);
|
|
60
|
-
}
|
|
61
|
-
g.restore();
|
|
62
|
-
g.fillStyle = RED;
|
|
63
|
-
g.globalAlpha = 0.9;
|
|
64
|
-
g.fillRect(W * 0.08, H * 0.78, W * 0.35 * Math.min(1, p), Math.max(3, H * 0.006));
|
|
65
|
-
g.globalAlpha = 1;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
window.READY = true;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"id": "hook",
|
|
4
|
-
"headline": "测试",
|
|
5
|
-
"caption": "",
|
|
6
|
-
"durationSec": 3
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"id": "body",
|
|
10
|
-
"headline": "Key point",
|
|
11
|
-
"caption": "一句话",
|
|
12
|
-
"durationSec": 5
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"id": "cta",
|
|
16
|
-
"headline": "Next step",
|
|
17
|
-
"caption": "",
|
|
18
|
-
"durationSec": 3
|
|
19
|
-
}
|
|
20
|
-
]
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Five Rules for a Poster — Swiss Motion Graphics · LemoLab × Claude Opus 5.5
|
|
2
|
-
|
|
3
|
-
Picture, typography, motion, score composition, foley: generated by code in this folder (original).
|
|
4
|
-
|
|
5
|
-
Fonts (SIL Open Font License 1.1):
|
|
6
|
-
- Archivo — The Archivo Project Authors (Omnibus-Type), https://github.com/Omnibus-Type/Archivo (fonts/OFL-Archivo.txt)
|
|
7
|
-
- UnifrakturMaguntia — j. 'mach' wust, Peter Wiegel (fonts/OFL-UnifrakturMaguntia.txt) — only in the "wrong typeface" gag
|
|
8
|
-
- DM Serif Display — Colophon Foundry / Google, based on Source Serif by Adobe (fonts/OFL-DMSerifDisplay.txt) — only in the "wrong typeface" gag
|
|
9
|
-
|
|
10
|
-
Music samples:
|
|
11
|
-
- Drums: "MuldjordKit" by Lars Muldjord (drumgizmo.org), FreePats version, licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
|
|
12
|
-
- Electric bass: FreePats project (freepats.zenvoid.org), CC0 1.0
|
|
13
|
-
- Glockenspiel: Versilian Community Sample Library (Versilian Studios), CC0 1.0
|
|
14
|
-
- Arpeggio synth, square lead, glide: numpy synthesis (original)
|
|
15
|
-
|
|
16
|
-
Voice: Kokoro-82M (Apache-2.0) via kokoro-onnx, voice af_sarah.
|
|
17
|
-
Speech check: faster-whisper (MIT).
|
|
18
|
-
|
|
19
|
-
ON SCREEN
|
|
20
|
-
The CC BY material above is credited on the end card, in fine print held at least 2.5 s: Drums MuldjordKit / Lars Muldjord · CC BY 4.0.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# Rebuild 《Five Rules for a Poster》 from scratch: sh styles/swiss-motion/demo/build.sh (runs from any folder)
|
|
3
|
-
set -e
|
|
4
|
-
sh "$(dirname "$0")/tools/fonts.sh" # fonts: not in git (CREDITS names them) → fonts/
|
|
5
|
-
cd "$(dirname "$0")/../../.."
|
|
6
|
-
PY=.venv/bin/python; D=styles/swiss-motion/demo; S=styles/swiss-motion
|
|
7
|
-
$PY core/tts/tts.py $D/lines.json $D/voices # 1. Kokoro voice-over (af_sarah, speed 1.0)
|
|
8
|
-
$PY core/tts/asr_check.py $D/lines.json $D/voices # 2. whisper line-by-line check (should give mismatches: 0)
|
|
9
|
-
$PY $D/tools/words.py # 3. word timings → subtitles snap in word by word
|
|
10
|
-
$PY $D/music/score.py # 4. original motorik score (reads score.json, ~4 s)
|
|
11
|
-
node core/render/events.mjs $D # 5. timeline → events.json (foley events)
|
|
12
|
-
$PY $D/mix.py # 6. foley + voice-over ducking + score → mix.wav
|
|
13
|
-
$PY $D/tools/subs.py && $PY core/render/srt.py $D/out/subs.json $S/swiss-motion.srt # 7. subtitles (asserts on-screen durations)
|
|
14
|
-
node core/render/video.mjs $D --fps 24 --workers 3 --out $D/out/video24.mp4 # 8. frame-by-frame render (~12 s)
|
|
15
|
-
sh core/render/mux.sh $D/out/video24.mp4 $D/mix.wav $S/swiss-motion.mp4 24 0 # 9. mux: −14 LUFS, grain 0
|
|
16
|
-
node core/render/still.mjs $D 33.4 --q nosub=1 --out $D/out/still --prefix sf_ && cp $D/out/still/sf_33.4.jpg $D/stills/styleframe.jpg
|
|
17
|
-
node core/render/still.mjs $D 43.5 --q 'nosub=1&poster=1' --out $D/out/still --prefix po_ && cp $D/out/still/po_43.5.jpg $S/poster.jpg
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Precise easing and snap tools. Swiss motion graphics allows only two curves: the precise ease cubic-bezier(.7,0,.2,1) and linear.
|
|
2
|
-
export const clamp = (x, a = 0, b = 1) => Math.max(a, Math.min(b, x));
|
|
3
|
-
export const lerp = (a, b, t) => a + (b - a) * t;
|
|
4
|
-
export const seg = (t, a, b) => clamp((t - a) / (b - a));
|
|
5
|
-
|
|
6
|
-
export function cubicBezier(x1, y1, x2, y2) {
|
|
7
|
-
const bx = u => 3 * (1 - u) * (1 - u) * u * x1 + 3 * (1 - u) * u * u * x2 + u * u * u;
|
|
8
|
-
const by = u => 3 * (1 - u) * (1 - u) * u * y1 + 3 * (1 - u) * u * u * y2 + u * u * u;
|
|
9
|
-
return t => {
|
|
10
|
-
if (t <= 0) return 0; if (t >= 1) return 1;
|
|
11
|
-
let lo = 0, hi = 1, u = t;
|
|
12
|
-
for (let i = 0; i < 30; i++) { const x = bx(u); if (Math.abs(x - t) < 1e-6) break; if (x < t) lo = u; else hi = u; u = (lo + hi) / 2; }
|
|
13
|
-
return by(u);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export const E = cubicBezier(.7, 0, .2, 1); // the only ease in the whole film
|
|
17
|
-
|
|
18
|
-
export const BPM = 120, BEAT = 60 / BPM, E8 = BEAT / 2, E16 = BEAT / 4, BAR = BEAT * 4;
|
|
19
|
-
|
|
20
|
-
// snap: lands in place at time t1, starting d seconds earlier (default one eighth note)
|
|
21
|
-
export const snap = (t, t1, d = E8) => E(seg(t, t1 - d, t1));
|
|
22
|
-
// linear segment
|
|
23
|
-
export const lin = (t, a, b) => seg(t, a, b);
|
|
24
|
-
// stepped rise: n steps, one precise ease per step ("one cell at a time")
|
|
25
|
-
export function steps(t, a, b, n) {
|
|
26
|
-
const p = seg(t, a, b) * n, i = Math.floor(p);
|
|
27
|
-
if (i >= n) return 1;
|
|
28
|
-
return (i + E(p - i)) / n;
|
|
29
|
-
}
|
|
30
|
-
// multi-segment snap track: keys = [[t_arrive, value, dur?], ...]; value can be a number or an array
|
|
31
|
-
export function track(keys) {
|
|
32
|
-
return t => {
|
|
33
|
-
let v = keys[0][1];
|
|
34
|
-
for (let i = 1; i < keys.length; i++) {
|
|
35
|
-
const [t1, v1, d = E8] = keys[i];
|
|
36
|
-
if (t < t1 - d) break;
|
|
37
|
-
const p = snap(t, t1, d);
|
|
38
|
-
v = Array.isArray(v1) ? v1.map((x, j) => lerp(v[j], x, p)) : lerp(v, v1, p);
|
|
39
|
-
if (p < 1) break;
|
|
40
|
-
}
|
|
41
|
-
return v;
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"dur":44,"ev":[{"t":0,"type":"knife","g":1},{"t":0.5625,"type":"rule","g":0.5},{"t":0.6875,"type":"rule","g":0.5},{"t":0.8125,"type":"rule","g":0.5},{"t":0.9375,"type":"rule","g":0.5},{"t":1.0625,"type":"rule","g":0.5},{"t":1.1875,"type":"rule","g":0.5},{"t":1.3125,"type":"rule","g":0.5},{"t":1.4375,"type":"rule","g":0.5},{"t":1.5625,"type":"rule","g":0.5},{"t":1.6875,"type":"rule","g":0.5},{"t":1.8125,"type":"rule","g":0.5},{"t":1.9375,"type":"rule","g":0.5},{"t":2,"type":"clack","g":0.9},{"t":2.25,"type":"clack","g":0.9},{"t":2.5,"type":"clack","g":0.9},{"t":2.75,"type":"clack","g":0.9},{"t":3,"type":"clack","g":0.9},{"t":3.5,"type":"paper","g":1},{"t":4.125,"type":"thunk","g":0.45},{"t":4.25,"type":"thunk","g":0.45},{"t":4.25,"type":"rule","g":0.7},{"t":4.375,"type":"thunk","g":0.45},{"t":4.4,"type":"voice","id":"l1"},{"t":4.5,"type":"thunk","g":0.6},{"t":4.5,"type":"rule","g":0.7},{"t":4.75,"type":"rule","g":0.7},{"t":5,"type":"rule","g":0.7},{"t":5.25,"type":"rule","g":0.7},{"t":5.5,"type":"rule","g":0.7},{"t":5.75,"type":"rule","g":0.7},{"t":5.875,"type":"rule","g":0.45},{"t":6,"type":"rule","g":0.7},{"t":6,"type":"rule","g":0.45},{"t":6.125,"type":"rule","g":0.45},{"t":6.25,"type":"rule","g":0.45},{"t":6.375,"type":"rule","g":0.45},{"t":6.5,"type":"rule","g":0.45},{"t":6.625,"type":"rule","g":0.45},{"t":6.75,"type":"rule","g":0.45},{"t":6.875,"type":"rule","g":0.45},{"t":7,"type":"rule","g":0.45},{"t":7.125,"type":"rule","g":0.45},{"t":7.25,"type":"rule","g":0.45},{"t":7.375,"type":"rule","g":0.45},{"t":7.5,"type":"rule","g":0.45},{"t":7.625,"type":"rule","g":0.45},{"t":7.75,"type":"rule","g":0.45},{"t":7.875,"type":"rule","g":0.45},{"t":8.125,"type":"thunk","g":0.45},{"t":8.125,"type":"clack","g":0.7},{"t":8.25,"type":"thunk","g":0.45},{"t":8.25,"type":"clack","g":0.7},{"t":8.375,"type":"thunk","g":0.45},{"t":8.375,"type":"clack","g":0.7},{"t":8.4,"type":"voice","id":"l2"},{"t":8.5,"type":"thunk","g":0.6},{"t":8.5,"type":"clack","g":0.7},{"t":8.625,"type":"clack","g":0.7},{"t":8.75,"type":"clack","g":0.7},{"t":8.875,"type":"clack","g":0.7},{"t":9,"type":"clack","g":0.7},{"t":9.125,"type":"clack","g":0.7},{"t":9.25,"type":"clack","g":0.7},{"t":10,"type":"clackBig","g":1},{"t":12.125,"type":"thunk","g":0.45},{"t":12.25,"type":"thunk","g":0.45},{"t":12.375,"type":"thunk","g":0.45},{"t":12.4,"type":"voice","id":"l3"},{"t":12.5,"type":"thunk","g":0.6},{"t":12.5,"type":"knife","g":0.8},{"t":13,"type":"knife","g":0.8},{"t":13.5,"type":"knife","g":0.8},{"t":14,"type":"knife","g":0.8},{"t":15,"type":"slide","g":0.5},{"t":15.0625,"type":"slide","g":0.5},{"t":15.125,"type":"slide","g":0.5},{"t":15.1875,"type":"slide","g":0.5},{"t":15.25,"type":"slide","g":0.5},{"t":15.3125,"type":"slide","g":0.5},{"t":16,"type":"clackBig","g":0.9},{"t":16,"type":"slide","g":0.7},{"t":16.125,"type":"thunk","g":0.45},{"t":16.25,"type":"thunk","g":0.45},{"t":16.375,"type":"thunk","g":0.45},{"t":16.4,"type":"voice","id":"l4"},{"t":16.5,"type":"thunk","g":0.6},{"t":18.125,"type":"snap","g":0.5},{"t":18.25,"type":"snap","g":0.5},{"t":18.375,"type":"snap","g":0.5},{"t":18.5,"type":"snap","g":0.5},{"t":18.625,"type":"snap","g":0.5},{"t":18.75,"type":"snap","g":0.5},{"t":18.875,"type":"snap","g":0.5},{"t":19,"type":"snap","g":0.5},{"t":19.125,"type":"snap","g":0.5},{"t":19.25,"type":"snap","g":0.5},{"t":19.375,"type":"snap","g":0.5},{"t":19.5,"type":"snap","g":0.5},{"t":19.625,"type":"snap","g":0.5},{"t":19.75,"type":"snap","g":0.5},{"t":19.875,"type":"snap","g":0.5},{"t":20,"type":"snap","g":0.5},{"t":20,"type":"thump","g":1},{"t":20.1,"type":"voice","id":"l4b"},{"t":22.125,"type":"thunk","g":0.45},{"t":22.15,"type":"voice","id":"l5"},{"t":22.25,"type":"thunk","g":0.45},{"t":22.375,"type":"thunk","g":0.45},{"t":22.5,"type":"thunk","g":0.6},{"t":23.625,"type":"tick","g":0.7},{"t":24,"type":"tick","g":0.6},{"t":24,"type":"slide","g":1},{"t":24.6,"type":"voice","id":"l5b"},{"t":26,"type":"thump","g":1.1},{"t":26.125,"type":"snap","g":0.6},{"t":26.25,"type":"snap","g":0.6},{"t":26.375,"type":"snap","g":0.6},{"t":26.5,"type":"snap","g":0.6},{"t":26.625,"type":"snap","g":0.6},{"t":26.75,"type":"snap","g":0.6},{"t":26.875,"type":"snap","g":0.6},{"t":27,"type":"snap","g":0.6},{"t":27.125,"type":"clack","g":0.6},{"t":27.25,"type":"clack","g":0.6},{"t":27.375,"type":"clack","g":0.6},{"t":27.5,"type":"clack","g":0.6},{"t":27.625,"type":"clack","g":0.6},{"t":27.75,"type":"clack","g":0.6},{"t":29.25,"type":"swish","g":1,"d":0.75},{"t":30.625,"type":"tick","g":0.35},{"t":30.6875,"type":"tick","g":0.35},{"t":30.75,"type":"tick","g":0.35},{"t":30.8125,"type":"tick","g":0.35},{"t":30.875,"type":"tick","g":0.35},{"t":30.9375,"type":"tick","g":0.35},{"t":31,"type":"tick","g":0.35},{"t":31.75,"type":"rule","g":0.8},{"t":36,"type":"swish","g":0.8,"d":1},{"t":36.5,"type":"voice","id":"l6"},{"t":39,"type":"knife","g":1.1},{"t":39.5,"type":"swish","g":0.6,"d":0.5},{"t":40.25,"type":"clack","g":0.7},{"t":40.5,"type":"clack","g":0.7},{"t":40.75,"type":"clack","g":0.7},{"t":41,"type":"clack","g":0.7}]}
|