调整测试页面的实时气泡:同一段 partial 只在识别文本增长时向后延伸,遇到模型回退或重写时保留当前内容;对应定稿到达后,再用定稿文本替换临时文本。

main
Bifang 2026-10-10 11:24:24 +08:00
parent ed4f5cb6d9
commit 86ebb44be4
1 changed files with 6 additions and 1 deletions

View File

@ -4283,7 +4283,12 @@ ${transcript}
if (existingPartialIndex >= 0) {
const existingPartial = state.liveTranscript[existingPartialIndex];
existingPartial.label = label;
existingPartial.text = safeText;
// The server sends a full, revisable partial snapshot. Only expose its
// newly appended suffix while streaming; keep the visible draft intact
// on rollback/revision, then let the final sentence replace it below.
if (safeText.startsWith(existingPartial.text)) {
existingPartial.text = safeText;
}
existingPartial.speaker = speaker;
existingPartial.speakerPending = speakerPending;
existingPartial.segmentIndex = segmentIndex;