feat: support subtitle chunks for AI

This commit is contained in:
Gabe
2025-10-11 21:06:38 +08:00
parent d9b4399c57
commit 1afe976777
6 changed files with 304 additions and 84 deletions

View File

@@ -230,4 +230,23 @@ export class BilingualSubtitleManager {
}
}
}
/**
* 追加新的字幕
* @param {Array<object>} newSubtitlesChunk - 新的、要追加的字幕数据块。
*/
appendSubtitles(newSubtitlesChunk) {
if (!newSubtitlesChunk || newSubtitlesChunk.length === 0) {
return;
}
logger.info(
`Bilingual Subtitle Manager: Appending ${newSubtitlesChunk.length} new subtitles...`
);
this.#formattedSubtitles.push(...newSubtitlesChunk);
this.#formattedSubtitles.sort((a, b) => a.start - b.start);
this.#currentSubtitleIndex = -1;
this.onTimeUpdate();
}
}