Skip to content

Enable voice responses by default for voice questions#6398

Merged
kodjima33 merged 6 commits into
mainfrom
worktree-voice-response-default
Apr 7, 2026
Merged

Enable voice responses by default for voice questions#6398
kodjima33 merged 6 commits into
mainfrom
worktree-voice-response-default

Conversation

@kodjima33
Copy link
Copy Markdown
Collaborator

Summary

  • Voice responses enabled by default for all users (was opt-in experimental)
  • Only plays voice for voice (PTT) queries — typed questions get text-only responses
  • Updated settings label from "Voice Answers (Experimental)" to "Voice Responses"
  • Added "Enable voice responses" checkbox to onboarding voice demo step
  • Onboarding title now shows the actual PTT key ("Hold Option and Ask" instead of "Hold and Ask")

Test plan

  • PTT voice question → AI response spoken aloud
  • Typed question → no audio response
  • Toggle off in Settings → voice stops for all queries
  • Onboarding checkbox controls the setting
  • Onboarding title shows correct PTT key

🤖 Generated with Claude Code

kodjima33 and others added 6 commits April 7, 2026 16:34
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass fromVoice flag through openAIInputWithQuery and sendFollowUpQuery
so voice playback only triggers for PTT queries, not typed ones.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kodjima33 kodjima33 merged commit 93797b7 into main Apr 7, 2026
3 checks passed
@kodjima33 kodjima33 deleted the worktree-voice-response-default branch April 7, 2026 20:35
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 7, 2026

Greptile Summary

This PR gates floating-bar voice responses to PTT (push-to-talk) queries only by tracking a currentQueryFromVoice flag per query, rather than playing voice for every query when the global toggle is on. It also enables voice responses by default (floatingBarVoiceAnswersEnabled default changed to true), updates the settings label, and adds a voice-responses checkbox to the onboarding voice-demo step.

Confidence Score: 5/5

Safe to merge — voice-gating logic is correct and all code paths stop prior playback before starting new queries

currentQueryFromVoice is properly set, propagated, and cleared in all code paths (openAIInputWithQuery, sendFollowUpQuery, clearVisibleConversation). sendAIQuery always calls FloatingBarVoicePlaybackService.shared.stop() first so typed queries naturally halt any in-progress voice. The default-true migration is correct: new users get true, existing users who never touched the setting also get true (key absent in UserDefaults), and users who explicitly disabled it retain false. Only remaining finding is a P2 style issue in OnboardingVoiceDemoView.

desktop/Desktop/Sources/OnboardingVoiceDemoView.swift — @State voiceResponsesEnabled could be refactored to bind directly to ShortcutSettings

Important Files Changed

Filename Overview
desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarState.swift Added currentQueryFromVoice published property; correctly reset in clearVisibleConversation()
desktop/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift openAIInputWithQuery and sendFollowUpQuery accept fromVoice; shouldPlayVoice captured from currentQueryFromVoice at send time; existing stop() prevents stale playback
desktop/Desktop/Sources/FloatingControlBar/PushToTalkManager.swift sendTranscript passes fromVoice:true to both openAIInputWithQuery and sendFollowUpQuery
desktop/Desktop/Sources/FloatingControlBar/ShortcutSettings.swift floatingBarVoiceAnswersEnabled default changed to true; existing users with explicit false retain their preference
desktop/Desktop/Sources/MainWindow/Pages/SettingsPage.swift Label updated to 'Voice Responses' with accurate description of per-query voice behaviour
desktop/Desktop/Sources/OnboardingVoiceDemoView.swift Title now shows dynamic PTT key; voice checkbox added but uses @State that could drift from ShortcutSettings

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User holds PTT shortcut] --> B[PushToTalkManager.startListening]
    B --> C[FloatingBarVoicePlaybackService.stop]
    B --> D[Audio capture + live transcription]
    D --> E[sendTranscript fromVoice:true]
    E --> F[openAIInputWithQuery / sendFollowUpQuery]
    F --> G[currentQueryFromVoice = true]
    G --> H[sendAIQuery]
    H --> I[FloatingBarVoicePlaybackService.stop]
    I --> J{shouldPlayVoice = currentQueryFromVoice AND voiceAnswersEnabled}
    J -->|true| K[playFillerIfEnabled]
    K --> L[AI streams response]
    L --> M[updateStreamingResponseIfEnabled]
    M --> N[Voice spoken aloud]
    J -->|false| O[Text-only response]
    P[User types query] -->|fromVoice:false| F2[openAIInputWithQuery]
    F2 --> G2[currentQueryFromVoice = false]
    G2 --> H
Loading

Reviews (1): Last reviewed commit: "Add voice responses checkbox and show PT..." | Re-trigger Greptile

Comment on lines 19 to +61
@@ -42,7 +43,7 @@ struct OnboardingVoiceDemoView: View {

VStack(spacing: 24) {
VStack(spacing: 12) {
Text("Hold and Ask")
Text("Hold \(shortcutSettings.pttShortcut.displayLabel) and Ask")
.font(.system(size: 24, weight: .bold))
.foregroundColor(OmiColors.textPrimary)

@@ -52,6 +53,24 @@ struct OnboardingVoiceDemoView: View {
.multilineTextAlignment(.center)
}

// Voice responses checkbox
HStack(spacing: 8) {
Toggle("", isOn: $voiceResponsesEnabled)
.toggleStyle(.checkbox)
.onChange(of: voiceResponsesEnabled) { _, newValue in
ShortcutSettings.shared.floatingBarVoiceAnswersEnabled = newValue
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Local @State can drift from ShortcutSettings

voiceResponsesEnabled is initialised once from ShortcutSettings.shared.floatingBarVoiceAnswersEnabled and is never re-synced if the setting is mutated externally (e.g. a SettingsSyncManager push after login completes during onboarding). The floatingBarVoiceAnswersBinding pattern already used in SettingsPage binds directly to the observed object and avoids the redundant state:

// In OnboardingVoiceDemoView — replace the @State and onChange with a binding helper:
private var floatingBarVoiceAnswersBinding: Binding<Bool> {
    Binding(
        get: { shortcutSettings.floatingBarVoiceAnswersEnabled },
        set: { newValue in
            shortcutSettings.floatingBarVoiceAnswersEnabled = newValue
            SettingsSyncManager.shared.pushPartialUpdate(
                AssistantSettingsResponse(
                    floatingBar: FloatingBarSettingsResponse(voiceAnswersEnabled: newValue)
                )
            )
        }
    )
}

Then bind the Toggle to floatingBarVoiceAnswersBinding and drop @State private var voiceResponsesEnabled.

Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…6398)

## Summary
- Voice responses enabled **by default** for all users (was opt-in
experimental)
- Only plays voice for **voice (PTT) queries** — typed questions get
text-only responses
- Updated settings label from "Voice Answers (Experimental)" to "Voice
Responses"
- Added "Enable voice responses" checkbox to onboarding voice demo step
- Onboarding title now shows the actual PTT key ("Hold Option and Ask"
instead of "Hold and Ask")

## Test plan
- [ ] PTT voice question → AI response spoken aloud
- [ ] Typed question → no audio response
- [ ] Toggle off in Settings → voice stops for all queries
- [ ] Onboarding checkbox controls the setting
- [ ] Onboarding title shows correct PTT key

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant