fix: improve voice and chat controls

This commit is contained in:
Edison Jwa
2026-05-25 18:26:56 +09:00
parent d03ea937e6
commit 487aff4e7c
13 changed files with 351 additions and 147 deletions
@@ -67,6 +67,7 @@ class VoiceSettingsDialog extends StatefulWidget {
this.pttLevel = '',
this.pttBackendId = '',
this.pttBoundInputClass = '',
this.onnxRuntimeAvailable = true,
this.talkPower,
this.neededTalkPower,
this.talkPowerGranted,
@@ -78,6 +79,7 @@ class VoiceSettingsDialog extends StatefulWidget {
final String pttLevel;
final String pttBackendId;
final String pttBoundInputClass;
final bool onnxRuntimeAvailable;
final int? talkPower;
final int? neededTalkPower;
final bool? talkPowerGranted;
@@ -101,6 +103,10 @@ class _VoiceSettingsDialogState extends State<VoiceSettingsDialog> {
_audioProcessing = AudioProcessingConfigState.fromConfig(
widget.initialAudioConfig,
);
_audioProcessing.vadBackend = normalizedVadBackend(
_audioProcessing.vadBackend,
onnxRuntimeAvailable: widget.onnxRuntimeAvailable,
);
}
rust.BridgeAudioProcessingConfig _buildConfig() {
@@ -291,17 +297,24 @@ class _VoiceSettingsDialogState extends State<VoiceSettingsDialog> {
const VoiceSubHeader('Backend'),
SegmentedButton<rust.BridgeVadBackend>(
style: voiceSegmentedButtonStyle(theme),
segments: _isDesktopSileroVadHost
? desktopVadBackendSegments
: vadBackendSegments,
segments: vadBackendSegmentsForAvailability(
desktop: _isDesktopSileroVadHost,
onnxRuntimeAvailable: widget.onnxRuntimeAvailable,
),
selected: {_audioProcessing.vadBackend},
onSelectionChanged: (s) =>
setState(() => _audioProcessing.vadBackend = s.first),
onSelectionChanged: (s) => setState(
() => _audioProcessing.vadBackend = normalizedVadBackend(
s.first,
onnxRuntimeAvailable: widget.onnxRuntimeAvailable,
),
),
),
const SizedBox(height: 8),
if (_isDesktopSileroVadHost)
Text(
'Silero gives the best quality when ONNX Runtime is installed. WebRTC works without ONNX Runtime and is the safer fallback if Linux setup is incomplete.',
widget.onnxRuntimeAvailable
? 'Silero gives the best quality when ONNX Runtime is installed. WebRTC works without ONNX Runtime and is the safer fallback if Linux setup is incomplete.'
: 'Silero is unavailable because ONNX Runtime was not found. WebRTC is selected until libonnxruntime.so is installed or bundled.',
style: theme.textTheme.bodySmall?.copyWith(
color: theme.colorScheme.onSurfaceVariant,
),