Power mode configuration before loading model

This commit is contained in:
Beingpax 2025-03-20 19:05:49 +05:45
parent 56c73693a8
commit d889e3a6c2

View File

@ -166,6 +166,9 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
if granted {
Task {
do {
// Start window configuration in parallel with recording setup
async let windowConfigTask = ActiveWindowService.shared.applyConfigurationForCurrentApp()
let file = try FileManager.default.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
@ -179,6 +182,10 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
self.recordedFile = file
self.transcriptionStartTime = Date()
// Wait for window configuration to complete
await windowConfigTask
// Start background tasks for model loading and screen capture
Task.detached(priority: .background) {
await self.performBackgroundTasks()
}
@ -209,8 +216,6 @@ class WhisperState: NSObject, ObservableObject, AVAudioRecorderDelegate {
}
}
await ActiveWindowService.shared.applyConfigurationForCurrentApp()
if let enhancementService = self.enhancementService,
enhancementService.isEnhancementEnabled &&
enhancementService.useScreenCaptureContext {