feat(audio): load input devices + setMicrophone in settings store (FR-CAP-7)

This commit is contained in:
iamdoubz committed 2026-07-06 16:26:24 -05:00
1 parent bb688418bf
commit 996c7edc99
1 file changed
+18
+18
View File
@@ -35,6 +35,8 @@ const DEFAULT_SETTINGS: AppSettings = {
pst_last_path: null,
pst_auto_sync: false,
audio_output_device: null, // system default render device (FR-CAP-1)
microphone_enabled: true, // capture the user's mic into the transcript (FR-CAP-7)
audio_input_device: null, // system default capture device
};
class SettingsStore {
@@ -50,6 +52,7 @@ class SettingsStore {
hardware = $state<HardwareStatus | null>(null);
models = $state<ModelInfo[]>([]);
audioDevices = $state<AudioDeviceInfo[]>([]);
inputDevices = $state<AudioDeviceInfo[]>([]);
downloadProgress = $state<Record<string, { received: number; total: number | null }>>({});
// Privacy self-check (T7.6, FR-SEC-2).
@@ -75,6 +78,7 @@ class SettingsStore {
}
await this.loadHardware();
await this.loadAudioDevices();
await this.loadInputDevices();
await this.loadModels();
await this.loadPrivacy();
await this.loadLlmStatus();
@@ -141,6 +145,20 @@ class SettingsStore {
await this.patch({ audio_output_device: deviceId });
}
async loadInputDevices() {
try {
this.inputDevices = await api.listInputDevices();
} catch {
this.inputDevices = [];
}
}
/** Set the microphone selection in one patch (FR-CAP-7): `enabled=false`
* disables mic capture entirely; `deviceId=null` uses the system default. */
async setMicrophone(enabled: boolean, deviceId: string | null) {
await this.patch({ microphone_enabled: enabled, audio_input_device: deviceId });
}
async loadModels() {
try {
this.models = await api.listModels();