-
Notifications
You must be signed in to change notification settings - Fork 836
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'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||||||||||||||||||||||||
Shimmer | ||||||||||||||||||||||||||||||||||||||||||||||||
</option> | ||||||||||||||||||||||||||||||||||||||||||||||||
</select> | ||||||||||||||||||||||||||||||||||||||||||||||||
</label> | ||||||||||||||||||||||||||||||||||||||||||||||||
<label> | ||||||||||||||||||||||||||||||||||||||||||||||||
<legend>{t('TTS Model')}</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||||||||||||||||||||||||
<select | ||||||||||||||||||||||||||||||||||||||||||||||||
required | ||||||||||||||||||||||||||||||||||||||||||||||||
onChange={(e) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
const model = e.target.value | ||||||||||||||||||||||||||||||||||||||||||||||||
updateConfig({ openAiTtsModel: model }) | ||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||||||||||||||||||
<option value="tts-1" selected={config.openAiTtsModel === 'tts-1'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
TTS-1 (Standard) | ||||||||||||||||||||||||||||||||||||||||||||||||
</option> | ||||||||||||||||||||||||||||||||||||||||||||||||
<option value="tts-1-hd" selected={config.openAiTtsModel === 'tts-1-hd'}> | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||||||||||||||||||||||||
TTS-1-HD (High Quality) | ||||||||||||||||||||||||||||||||||||||||||||||||
</option> | ||||||||||||||||||||||||||||||||||||||||||||||||
</select> | ||||||||||||||||||||||||||||||||||||||||||||||||
</label> | ||||||||||||||||||||||||||||||||||||||||||||||||
<label> | ||||||||||||||||||||||||||||||||||||||||||||||||
<legend>{t('TTS Speed')}</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||||||||||||||||||||||||||||||||||||
<input | ||||||||||||||||||||||||||||||||||||||||||||||||
type="range" | ||||||||||||||||||||||||||||||||||||||||||||||||
min="0.25" | ||||||||||||||||||||||||||||||||||||||||||||||||
max="4.0" | ||||||||||||||||||||||||||||||||||||||||||||||||
step="0.25" | ||||||||||||||||||||||||||||||||||||||||||||||||
value={config.openAiTtsSpeed} | ||||||||||||||||||||||||||||||||||||||||||||||||
onChange={(e) => { | ||||||||||||||||||||||||||||||||||||||||||||||||
const speed = parseFloat(e.target.value) | ||||||||||||||||||||||||||||||||||||||||||||||||
updateConfig({ openAiTtsSpeed: speed }) | ||||||||||||||||||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||
<span>{config.openAiTtsSpeed}x</span> | ||||||||||||||||||||||||||||||||||||||||||||||||
</label> | ||||||||||||||||||||||||||||||||||||||||||||||||
</> | ||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||
</fieldset> | ||||||||||||||||||||||||||||||||||||||||||||||||
<br /> | ||||||||||||||||||||||||||||||||||||||||||||||||
<div style={{ display: 'flex', gap: '10px' }}> | ||||||||||||||||||||||||||||||||||||||||||||||||
<button | ||||||||||||||||||||||||||||||||||||||||||||||||
|
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 alabel
. Use aspan
ordiv
element instead, or move thelegend
outside thelabel
if you need fieldset grouping.Copilot uses AI. Check for mistakes.