Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src-tauri/src/commands/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,10 @@ pub fn get_clamshell_microphone(app: AppHandle) -> Result<String, String> {
.clamshell_microphone
.unwrap_or_else(|| "default".to_string()))
}

#[tauri::command]
#[specta::specta]
pub fn is_recording(app: AppHandle) -> bool {
let audio_manager = app.state::<Arc<AudioRecordingManager>>();
audio_manager.is_recording()
}
1 change: 1 addition & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ pub fn run() {
commands::audio::check_custom_sounds,
commands::audio::set_clamshell_microphone,
commands::audio::get_clamshell_microphone,
commands::audio::is_recording,
commands::transcription::set_model_unload_timeout,
commands::transcription::get_model_load_status,
commands::transcription::unload_model_manually,
Expand Down
3 changes: 3 additions & 0 deletions src/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ async getClamshellMicrophone() : Promise<Result<string, string>> {
else return { status: "error", error: e as any };
}
},
async isRecording() : Promise<boolean> {
return await TAURI_INVOKE("is_recording");
},
async setModelUnloadTimeout(timeout: ModelUnloadTimeout) : Promise<void> {
await TAURI_INVOKE("set_model_unload_timeout", { timeout });
},
Expand Down
16 changes: 12 additions & 4 deletions src/components/model-selector/ModelSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ const ModelSelector: React.FC<ModelSelectorProps> = ({ onError }) => {
});
loadModels(); // Refresh models list

// Auto-select the newly downloaded model
setTimeout(() => {
// Auto-select the newly downloaded model (skip if recording in progress)
setTimeout(async () => {
const recordingResult = await commands.isRecording();
if (recordingResult.status === "ok" && recordingResult.data) {
return; // Skip auto-switch if recording in progress
}
loadCurrentModel();
handleModelSelect(modelId);
}, 500);
Expand Down Expand Up @@ -193,8 +197,12 @@ const ModelSelector: React.FC<ModelSelectorProps> = ({ onError }) => {
});
loadModels(); // Refresh models list

// Auto-select the newly extracted model
setTimeout(() => {
// Auto-select the newly extracted model (skip if recording in progress)
setTimeout(async () => {
const recordingResult = await commands.isRecording();
if (recordingResult.status === "ok" && recordingResult.data) {
return; // Skip auto-switch if recording in progress
}
loadCurrentModel();
handleModelSelect(modelId);
}, 500);
Expand Down