fix(asr): keep recordings when streaming recognition fails or stalls
- Keep recording after a streaming ASR error and retry the captured PCM through batch ASR before reporting a failure. - Treat an expired ASR wait as a stall so batch fallback still runs. - Prime the managed Volcengine stream on mic touch and adopt it only while fresh and open. - Auto-scroll the live transcript to the newest recognized text.
This commit is contained in:
@@ -43,6 +43,25 @@ final class UtteranceBatchFallbackPolicyTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func testShouldRunWhenRecognitionStalledWithoutAnyText() {
|
||||
XCTAssertTrue(
|
||||
UtteranceBatchFallbackPolicy.shouldRunBatchFallback(
|
||||
stitchedFinal: "",
|
||||
partialSnapshot: "",
|
||||
recognitionStalled: true
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func testShouldNotRunForCompletedSilence() {
|
||||
XCTAssertFalse(
|
||||
UtteranceBatchFallbackPolicy.shouldRunBatchFallback(
|
||||
stitchedFinal: "",
|
||||
partialSnapshot: ""
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
func testPreferredTranscriptPicksLongestCandidate() {
|
||||
let resolved = UtteranceBatchFallbackPolicy.preferredTranscript(
|
||||
batch: "今天很好,我们一起去公园吧",
|
||||
|
||||
Reference in New Issue
Block a user