feat: migrate on-device Qwen3 ASR to CoreML for background Flow dictation
Replace MLX GPU inference with CoreML bundles so transcription continues while the host app is backgrounded. Adds model download and warm-up, vendored Qwen3Speech, and updates onboarding, settings, and copy for the ~1.6 GB CoreML package (iOS 18+).
This commit is contained in:
@@ -13,14 +13,25 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
return defaults
|
||||
}
|
||||
|
||||
func testSessionActiveRequiresFreshHeartbeat() {
|
||||
func testSessionActiveSurvivesStaleHeartbeatWhileNotExpired() {
|
||||
let defaults = makeDefaults()
|
||||
FlowSessionBridge.markSessionActive(duration: 60, defaults: defaults)
|
||||
XCTAssertTrue(FlowSessionBridge.isSessionActive(defaults: defaults))
|
||||
XCTAssertTrue(FlowSessionBridge.isHostReachable(defaults: defaults))
|
||||
|
||||
let staleHeartbeat = Date().timeIntervalSince1970 - 10
|
||||
defaults.set(staleHeartbeat, forKey: FlowSessionKeys.flowHeartbeat)
|
||||
XCTAssertTrue(FlowSessionBridge.isSessionActive(defaults: defaults))
|
||||
XCTAssertFalse(FlowSessionBridge.isHostReachable(defaults: defaults))
|
||||
}
|
||||
|
||||
func testSessionInactiveWhenExpired() {
|
||||
let defaults = makeDefaults()
|
||||
FlowSessionBridge.markSessionActive(duration: 1, defaults: defaults)
|
||||
let expired = Date().timeIntervalSince1970 - 5
|
||||
defaults.set(expired, forKey: FlowSessionKeys.flowSessionExpires)
|
||||
XCTAssertFalse(FlowSessionBridge.isSessionActive(defaults: defaults))
|
||||
XCTAssertFalse(FlowSessionBridge.isHostReachable(defaults: defaults))
|
||||
}
|
||||
|
||||
func testRecordingStateRoundTrip() {
|
||||
@@ -39,6 +50,19 @@ final class FlowSessionBridgeTests: XCTestCase {
|
||||
XCTAssertNil(FlowSessionBridge.consumeTranscriptionResult(defaults: defaults))
|
||||
}
|
||||
|
||||
func testConsumeTranscriptionDeliveryIncludesPolishWarning() {
|
||||
let defaults = makeDefaults()
|
||||
FlowSessionBridge.storeTranscriptionResult(
|
||||
"raw text",
|
||||
polishWarning: "polish failed",
|
||||
defaults: defaults
|
||||
)
|
||||
let delivery = FlowSessionBridge.consumeTranscriptionDelivery(defaults: defaults)
|
||||
XCTAssertEqual(delivery?.text, "raw text")
|
||||
XCTAssertEqual(delivery?.polishWarning, "polish failed")
|
||||
XCTAssertNil(FlowSessionBridge.consumeTranscriptionDelivery(defaults: defaults))
|
||||
}
|
||||
|
||||
func testClearFlowStateRemovesSessionKeys() {
|
||||
let defaults = makeDefaults()
|
||||
FlowSessionBridge.markSessionActive(defaults: defaults)
|
||||
|
||||
Reference in New Issue
Block a user