Fix: Remove compiler checks for SpeechAnalyzer API
This commit is contained in:
parent
f0a3383139
commit
0ad5b20068
@ -62,7 +62,6 @@ class NativeAppleTranscriptionService: TranscriptionService {
|
||||
throw ServiceError.unsupportedOS
|
||||
}
|
||||
|
||||
#if canImport(Speech) && compiler(>=6.0) && swift(>=6.0)
|
||||
logger.notice("Starting Apple native transcription with SpeechAnalyzer.")
|
||||
|
||||
let audioFile = try AVAudioFile(forReading: audioURL)
|
||||
@ -141,14 +140,8 @@ class NativeAppleTranscriptionService: TranscriptionService {
|
||||
|
||||
logger.notice("Native transcription successful. Length: \(finalTranscription.count) characters.")
|
||||
return finalTranscription
|
||||
|
||||
#else
|
||||
logger.error("SpeechTranscriber is not available in this compiler version or Speech framework is not available")
|
||||
throw ServiceError.unsupportedOS
|
||||
#endif
|
||||
}
|
||||
|
||||
#if compiler(>=6.0) && swift(>=6.0)
|
||||
@available(macOS 26, *)
|
||||
private func deallocateExistingAssets() async throws {
|
||||
#if canImport(Speech)
|
||||
@ -159,9 +152,7 @@ class NativeAppleTranscriptionService: TranscriptionService {
|
||||
logger.notice("Deallocated existing asset locales.")
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.0) && swift(>=6.0)
|
||||
@available(macOS 26, *)
|
||||
private func allocateAssetsForLocale(_ locale: Locale) async throws {
|
||||
#if canImport(Speech)
|
||||
@ -174,9 +165,7 @@ class NativeAppleTranscriptionService: TranscriptionService {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if compiler(>=6.0) && swift(>=6.0)
|
||||
@available(macOS 26, *)
|
||||
private func ensureModelIsAvailable(for transcriber: SpeechTranscriber, locale: Locale) async throws {
|
||||
#if canImport(Speech)
|
||||
@ -196,5 +185,4 @@ class NativeAppleTranscriptionService: TranscriptionService {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user