Skip to content

Conversation

@Abhijay007
Copy link
Collaborator

@Abhijay007 Abhijay007 commented Jan 17, 2026

Closes: #6063

PR description

This PR fixes a bug where ElevenLabs API keys were not persisting in the desktop UI.

Changes:

  • Fixed key existence detection logic in both the settings hook and key input component
  • Improved UI styling for provider dropdown (overflow, width, text wrapping)

Type of Change

  • Bug fix

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Tested in Desktop UI with the whole functionality

Screenshots/Demos (for UX changes)

Before:
elevanLabsFix

After:

elevanLabsFixAfter

Copilot AI review requested due to automatic review settings January 17, 2026 20:15
@Abhijay007 Abhijay007 requested a review from zanesq January 17, 2026 20:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where ElevenLabs API keys were not persisting in the desktop UI. The core fix changes the key existence check from keyExists === true to keyExists !== null to properly detect stored keys.

Changes:

  • Fixed key existence detection logic in both the settings hook and key input component
  • Added masked value display (••••••••••••••••) for existing keys with focus/blur handling
  • Added 32-character minimum validation for ElevenLabs API keys
  • Improved UI styling for provider dropdown (overflow, width, text wrapping)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ui/desktop/src/hooks/useDictationSettings.ts Fixed key existence check from === true to !== null
ui/desktop/src/components/settings/dictation/ElevenLabsKeyInput.tsx Enhanced key persistence logic with masked display, validation, and better state handling
ui/desktop/src/components/settings/dictation/VoiceDictationToggle.tsx Changed overflow from hidden to visible to prevent dropdown clipping
ui/desktop/src/components/settings/dictation/ProviderSelector.tsx Improved dropdown styling with better width constraints and text formatting
Comments suppressed due to low confidence (1)

ui/desktop/src/components/settings/dictation/ElevenLabsKeyInput.tsx:52

  • The unmount effect saves the key without validation. If a user enters an invalid key (less than 32 characters) and the component unmounts before onBlur fires, the invalid key will be saved. Consider adding the same validation here or removing this unmount save since onBlur already handles saving.
  useEffect(() => {
    return () => {
      if (elevenLabsApiKeyRef.current && elevenLabsApiKeyRef.current !== '••••••••••••••••') {
        const keyToSave = elevenLabsApiKeyRef.current;
        if (keyToSave.trim()) {
          upsert(ELEVENLABS_API_KEY, keyToSave, true).catch((error) => {
            console.error('Error saving ElevenLabs API key on unmount:', error);
          });
        }
      }
    };

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • ui/desktop/package-lock.json: Language not supported

Copilot AI review requested due to automatic review settings January 23, 2026 18:22
@Abhijay007 Abhijay007 marked this pull request as draft January 23, 2026 18:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • ui/desktop/package-lock.json: Language not supported

@Abhijay007 Abhijay007 marked this pull request as ready for review January 23, 2026 18:41
Copilot AI review requested due to automatic review settings January 23, 2026 18:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • ui/desktop/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

ui/desktop/src/hooks/dictationConstants.ts:7

  • Assignment to variable isSecretKeyConfigured, which is declared constant.
export const isSecretKeyConfigured = (response: unknown): boolean =>

Copilot AI review requested due to automatic review settings January 23, 2026 19:10
@Abhijay007
Copy link
Collaborator Author

Updated UX

updateProvider

cc : @lifeizhou-ap

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • ui/desktop/package-lock.json: Language not supported

@lifeizhou-ap
Copy link
Collaborator

Thank you @Abhijay007!

One thing I noticed the changes to optimise api call in the PR have been removed in this PR. Just wondering whether it is intentional or not.

@Abhijay007
Copy link
Collaborator Author

Thank you @Abhijay007!

One thing I noticed the changes to optimise api call in the PR have been removed in this PR. Just wondering whether it is intentional or not.

oh yea, thanks @lifeizhou-ap for letting me know I made some mistakes while resolving merge conflicts and missed those changes 😅 , I updated em now

Copilot AI review requested due to automatic review settings January 26, 2026 18:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • ui/desktop/package-lock.json: Language not supported

@taniandjerry
Copy link
Contributor

It looks like comments were addressed, tagging @lifeizhou-ap and @zanesq again!

setElevenLabsApiKey('');
setValidationError('');
setIsEditing(false);
await loadKey();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @Abhijay007 just curious why we hav to loadKey again in the upsert and remove? It added an extra call to the server side and it seems unnecessary? Shall we just update the cache and hasElevenLabsKey instead of the additional call?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it was mentioned here by copoilt : #6557 (comment) so I thought of implementing it

@@ -1,5 +1,6 @@
import { useState, useEffect, useRef } from 'react';
import { useState, useEffect, useCallback } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

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

frankly, this whole module feels rather complicated. aren't we just setting an API key? there's validation code, but all it seems to do is check that the API key is set. or that the server failed but that's not very useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

frankly, this whole module feels rather complicated. aren't we just setting an API key? there's validation code, but all it seems to do is check that the API key is set. or that the server failed but that's not very useful.

@lifeizhou-ap , @DOsinga should I consider this update in this PR or make another one for this refactor ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @Abhijay007,

Let's make another PR for this refactor.

@lifeizhou-ap
Copy link
Collaborator

lifeizhou-ap commented Jan 26, 2026

they should both be constants, no?

Hi @DOsinga Yes. This is my fault because I did not extract openai as constant in another PR. I was intending to extract in the same PR, but openai is used in different contexts. It was not just used in dictation, it is also used in provider, and other etc. So I did not do it and thought about doing later.

Now I realised that I has overthought about the risk of extracting the openai constant. It is ok to only replace dictation related openai.

@lifeizhou-ap
Copy link
Collaborator

lifeizhou-ap commented Jan 27, 2026

Hi @Abhijay007,

I also checked out your branch and it works well!

One feedback about the "Remove" button in UI.

This is your current UI
Screenshot 2026-01-27 at 10 34 08 am. With the "Remove" below the input text box, user may think it only removes the text in the input box instead of removing the api key.

I feel it will be clearer to user if we put next to "Update API Key". WDTY? (does not need to be in this PR. we can address this later if this makes sense)
Screenshot 2026-01-27 at 10 34 17 am

@Abhijay007
Copy link
Collaborator Author

Hi @Abhijay007,

I also checked out your branch and it works well!

One feedback about the "Remove" button in UI.

This is your current UI Screenshot 2026-01-27 at 10 34 08 am. With the "Remove" below the input text box, user may think it only removes the text in the input box instead of removing the api key.

I feel it will be clearer to user if we put next to "Update API Key". WDTY? (does not need to be in this PR. we can address this later if this makes sense) Screenshot 2026-01-27 at 10 34 17 am

I think it's nice if we handle it in another PR

Copilot AI review requested due to automatic review settings January 27, 2026 11:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@lifeizhou-ap
Copy link
Collaborator

they should both be constants, no?

Hi @DOsinga Yes. This is my fault because I did not extract openai as constant in another PR. I was intending to extract in the same PR, but openai is used in different contexts. It was not just used in dictation, it is also used in provider, and other etc. So I did not do it and thought about doing later.

Now I realised that I has overthought about the risk of extracting the openai constant. It is ok to only replace dictation related openai.

Thank you @Abhijay007 to extract it!

@Abhijay007 Abhijay007 merged commit 2a41f5d into block:main Jan 27, 2026
23 checks passed
zanesq added a commit that referenced this pull request Jan 27, 2026
…upport

* origin/main: (79 commits)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
  fix: Manual compaction does not update context window. (#6682)
  Removed the Acceptable Usage Policy (#6204)
  Document spellcheck toggle (#6721)
  fix: docs workflow cleanup and prevent cancellations (#6713)
  Docs: file bug directly (#6718)
  fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679)
  Speed up Databricks provider init by removing fetch of supported models (#6616)
  fix: correct typos in documentation and Justfile (#6686)
  docs: frameDomains and baseUriDomains for mcp apps (#6684)
  docs: add Remotion video creation tutorial (#6675)
  docs: export recipe and copy yaml (#6680)
  ...

# Conflicts:
#	ui/desktop/src/hooks/useChatStream.ts
katzdave added a commit that referenced this pull request Jan 27, 2026
…ovider

* 'main' of github.com:block/goose:
  fix slash and @ keyboard navigation popover background color (#6550)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
zanesq added a commit that referenced this pull request Jan 27, 2026
* 'main' of github.com:block/goose:
  Create default gooseignore file when missing (#6498)
  fix slash and @ keyboard navigation popover background color (#6550)
  fix[format/openai]: return error on empty msg. (#6511)
  Fix: ElevenLabs API Key Not Persisting (#6557)
  Logging uplift for model training purposes (command injection model) [Small change] (#6330)
  fix(goose): only send agent-session-id when a session exists (#6657)
  BERT-based command injection detection in tool calls (#6599)
  chore: [CONTRIBUTING.md] add Hermit to instructions (#6518)
  fix: update Gemini context limits (#6536)
  Document r slash command (#6724)
  Upgrade GitHub Actions to latest versions (#6700)
  fix: Manual compaction does not update context window. (#6682)
  Removed the Acceptable Usage Policy (#6204)
  Document spellcheck toggle (#6721)
  fix: docs workflow cleanup and prevent cancellations (#6713)
  Docs: file bug directly (#6718)
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.

ElevenLabs API Key Not Persisting in Voice Dictation Settings

5 participants