fix(flow): improve tail capture and final chunk ASR recovery
- Add FlowUtteranceEndCoordinator with 350ms silence drain and 150ms post-roll - Extend FinalChunkRecovery for short/empty final chunks in chunked pipeline - Snapshot partial at mic stop and guard final transcript in FlowSessionManager - Unify tail drain presets (iosFlow/macMLX) and expand diagnostics Co-authored-by: Rocky <hkgood@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
// UtteranceTranscriptGuardTests.swift
|
||||
// OSGKeyboardTests
|
||||
|
||||
import XCTest
|
||||
@testable import OSGKeyboardShared
|
||||
|
||||
final class UtteranceTranscriptGuardTests: XCTestCase {
|
||||
|
||||
func testResolvePrefersPartialWhenClearlyLonger() {
|
||||
let resolved = UtteranceTranscriptGuard.resolve(
|
||||
stitchedFinal: "今天天气很好",
|
||||
partialSnapshot: "今天天气很好,我们一起去公园吧"
|
||||
)
|
||||
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
|
||||
}
|
||||
|
||||
func testResolveKeepsFinalWhenPartialIsNotLonger() {
|
||||
let resolved = UtteranceTranscriptGuard.resolve(
|
||||
stitchedFinal: "今天天气很好,我们一起去公园吧",
|
||||
partialSnapshot: "今天天气很好"
|
||||
)
|
||||
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
|
||||
}
|
||||
|
||||
func testResolveUsesPartialWhenFinalEmpty() {
|
||||
let resolved = UtteranceTranscriptGuard.resolve(
|
||||
stitchedFinal: "",
|
||||
partialSnapshot: "最后一段 partial"
|
||||
)
|
||||
XCTAssertEqual(resolved, "最后一段 partial")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user