TTS Rate: fix settings load. Hide when System source.

This commit is contained in:
Cohee 2024-05-16 09:35:48 +03:00
parent 74256dc411
commit 517da9f972
1 changed files with 8 additions and 5 deletions

View File

@ -530,6 +530,10 @@ function loadSettings() {
$('#tts_pass_asterisks').prop('checked', extension_settings.tts.pass_asterisks);
$('#tts_skip_codeblocks').prop('checked', extension_settings.tts.skip_codeblocks);
$('#tts_skip_tags').prop('checked', extension_settings.tts.skip_tags);
$('#playback_rate').val(extension_settings.tts.playback_rate);
$('#playback_rate_counter').val(Number(extension_settings.tts.playback_rate).toFixed(2));
$('#playback_rate_block').toggle(extension_settings.tts.currentProvider !== 'System');
$('body').toggleClass('tts', extension_settings.tts.enabled);
}
@ -539,7 +543,7 @@ const defaultSettings = {
currentProvider: 'ElevenLabs',
auto_generation: true,
narrate_user: false,
playback_rate: 1
playback_rate: 1,
};
function setTtsStatus(status, success) {
@ -651,6 +655,7 @@ async function loadTtsProvider(provider) {
function onTtsProviderChange() {
const ttsProviderSelection = $('#tts_provider').val();
extension_settings.tts.currentProvider = ttsProviderSelection;
$('#playback_rate_block').toggle(extension_settings.tts.currentProvider !== 'System');
loadTtsProvider(ttsProviderSelection);
}
@ -1024,10 +1029,10 @@ $(document).ready(function () {
<small>Pass Asterisks to TTS Engine</small>
</label>
</div>
<div class="range-block">
<div id="playback_rate_block" class="range-block">
<hr>
<div class="range-block-title justifyLeft" data-i18n="Audio Playback Speed">
Audio Playback Speed
<small>Audio Playback Speed</small>
</div>
<div class="range-block-range-and-counter">
<div class="range-block-range">
@ -1063,8 +1068,6 @@ $(document).ready(function () {
$('#tts_auto_generation').on('click', onAutoGenerationClick);
$('#tts_narrate_user').on('click', onNarrateUserClick);
$('#playback_rate').val(extension_settings.tts.playback_rate);
$('#playback_rate_counter').val(Number(extension_settings.tts.playback_rate).toFixed(2));
$('#playback_rate').on('input', function () {
const value = $(this).val();
const formattedValue = Number(value).toFixed(2);