-
Notifications
You must be signed in to change notification settings - Fork 847
Add OpenAI TTS support to replace system text-to-speech with high-quality AI voices #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -631,6 +631,88 @@ export function GeneralPart({ config, updateConfig, setTabIndex }) { | |||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||
| {t("Crop Text to ensure the input tokens do not exceed the model's limit")} | ||||||||||||||||||||||||||||||||||||||||||||||||
| </label> | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Text-to-Speech Settings */} | ||||||||||||||||||||||||||||||||||||||||||||||||
| <br /> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <fieldset> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <legend>{t('Text-to-Speech Settings')}</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <label> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <input | ||||||||||||||||||||||||||||||||||||||||||||||||
| type="checkbox" | ||||||||||||||||||||||||||||||||||||||||||||||||
| checked={config.enableOpenAiTts} | ||||||||||||||||||||||||||||||||||||||||||||||||
| onChange={(e) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| const checked = e.target.checked | ||||||||||||||||||||||||||||||||||||||||||||||||
| updateConfig({ enableOpenAiTts: checked }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||
| {t('Enable OpenAI TTS (requires API key)')} | ||||||||||||||||||||||||||||||||||||||||||||||||
| </label> | ||||||||||||||||||||||||||||||||||||||||||||||||
| {config.enableOpenAiTts && ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| <> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <label> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <legend>{t('TTS Voice')}</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <select | ||||||||||||||||||||||||||||||||||||||||||||||||
| required | ||||||||||||||||||||||||||||||||||||||||||||||||
| onChange={(e) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
| const voice = e.target.value | ||||||||||||||||||||||||||||||||||||||||||||||||
| updateConfig({ openAiTtsVoice: voice }) | ||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="alloy" selected={config.openAiTtsVoice === 'alloy'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
| Alloy | ||||||||||||||||||||||||||||||||||||||||||||||||
| </option> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="echo" selected={config.openAiTtsVoice === 'echo'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
| Echo | ||||||||||||||||||||||||||||||||||||||||||||||||
| </option> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="fable" selected={config.openAiTtsVoice === 'fable'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
| Fable | ||||||||||||||||||||||||||||||||||||||||||||||||
| </option> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="onyx" selected={config.openAiTtsVoice === 'onyx'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
| Onyx | ||||||||||||||||||||||||||||||||||||||||||||||||
| </option> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="nova" selected={config.openAiTtsVoice === 'nova'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
| Nova | ||||||||||||||||||||||||||||||||||||||||||||||||
| </option> | ||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="shimmer" selected={config.openAiTtsVoice === 'shimmer'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
| <option value="shimmer" selected={config.openAiTtsVoice === 'shimmer'}> | |
| value={config.openAiTtsVoice || 'alloy'} | |
| onChange={(e) => { | |
| const voice = e.target.value | |
| updateConfig({ openAiTtsVoice: voice }) | |
| }} | |
| > | |
| <option value="alloy"> | |
| Alloy | |
| </option> | |
| <option value="echo"> | |
| Echo | |
| </option> | |
| <option value="fable"> | |
| Fable | |
| </option> | |
| <option value="onyx"> | |
| Onyx | |
| </option> | |
| <option value="nova"> | |
| Nova | |
| </option> | |
| <option value="shimmer"> |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legend element should not be used inside a label. Use a span or div element instead, or move the legend outside the label if you need fieldset grouping.
| <legend>{t('TTS Model')}</legend> | |
| <span>{t('TTS Model')}</span> |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the value prop instead of selected attribute for React select elements. The selected attribute is deprecated in React. Set the value prop on the select element to config.openAiTtsModel || 'tts-1'.
| <option value="tts-1-hd" selected={config.openAiTtsModel === 'tts-1-hd'}> | |
| value={config.openAiTtsModel || 'tts-1'} | |
| onChange={(e) => { | |
| const model = e.target.value | |
| updateConfig({ openAiTtsModel: model }) | |
| }} | |
| > | |
| <option value="tts-1"> | |
| TTS-1 (Standard) | |
| </option> | |
| <option value="tts-1-hd"> |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The legend element should not be used inside a label. Use a span or div element instead, or move the legend outside the label if you need fieldset grouping.
| <legend>{t('TTS Speed')}</legend> | |
| <span>{t('TTS Speed')}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
legendelement should not be used inside alabel. Use aspanordivelement instead, or move thelegendoutside thelabelif you need fieldset grouping.