537a68552a
Reduce perceived latency from key release to final text: - Adaptive chunking: 2.5s first chunk + 5s follow-ups so short utterances start on-device recognition while still recording. - Session-level ASR warmup and audio-format cache reuse to remove per-utterance cold-start of SpeechAnalyzer. - Mirror live pipelined partials to the keyboard transcript line via a new flow.transcriptionPartial App Group key + Darwin ping. Also commits the accumulated custom language model, Flow session, keyboard extension restructure, and Xiaomi MiMo provider work in progress on this branch.
33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
// EngineServiceLabel.swift
|
|
// OSGKeyboard · Shared
|
|
//
|
|
// Human-readable summary of the active engine / AI provider for UI hints.
|
|
|
|
import Foundation
|
|
|
|
public enum EngineServiceLabel {
|
|
public static func summary(
|
|
engineMode: String,
|
|
providerId: String,
|
|
model: String,
|
|
language: AppUILanguage? = nil
|
|
) -> String {
|
|
let lang = language ?? AppGroupStore().uiLanguage
|
|
if engineMode == "local" {
|
|
let asrName = SharedL10n.string("engine.asr.appleSpeech", language: lang)
|
|
return SharedL10n.format("engine.summary.local", language: lang, asrName)
|
|
}
|
|
let providerName = ProviderDisplayName.name(for: providerId, language: lang)
|
|
let trimmedModel = model.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
if trimmedModel.isEmpty {
|
|
return SharedL10n.format("engine.summary.cloud", language: lang, providerName)
|
|
}
|
|
return SharedL10n.format(
|
|
"engine.summary.cloudWithModel",
|
|
language: lang,
|
|
providerName,
|
|
trimmedModel
|
|
)
|
|
}
|
|
}
|