12.26
This commit is contained in:
@ -141,6 +141,7 @@ async function generateAnimationStream(text, apiUrl) {
|
||||
const flushBatchMs = 50;
|
||||
const minStartFrames = Math.max(1, Math.round(animator.dataFps * (streamBufferMs / 1000)));
|
||||
const frameBatchSize = Math.max(1, Math.round(animator.dataFps * (flushBatchMs / 1000)));
|
||||
let sentenceTexts = []; // 存储句子文本
|
||||
|
||||
const flushFrames = (force = false) => {
|
||||
if (pendingFrames.length === 0) {
|
||||
@ -151,9 +152,7 @@ async function generateAnimationStream(text, apiUrl) {
|
||||
}
|
||||
const framesToFlush = pendingFrames.splice(0, pendingFrames.length);
|
||||
animator.appendAnimationFrames(framesToFlush);
|
||||
console.log(`Flushed ${framesToFlush.length} frames, total: ${animator.animationFrames.length}`);
|
||||
if (!started && animator.animationFrames.length >= minStartFrames) {
|
||||
console.log(`Starting animation with ${animator.animationFrames.length} frames (min: ${minStartFrames})`);
|
||||
animator.playAnimation();
|
||||
started = true;
|
||||
}
|
||||
@ -170,6 +169,12 @@ async function generateAnimationStream(text, apiUrl) {
|
||||
const stageMessage = message.message || 'Streaming';
|
||||
showStatus(stageMessage, 'info');
|
||||
console.log('Stream status:', message);
|
||||
// 保存句子文本并传递给动画器
|
||||
if (message.sentence_texts) {
|
||||
sentenceTexts = message.sentence_texts;
|
||||
animator.sentenceTexts = sentenceTexts;
|
||||
console.log('[前端调试] 接收到句子列表:', sentenceTexts);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user