Expose playFullConversation to UI
This commit is contained in:
parent
fb7e8e73ee
commit
526d41edc3
|
@ -14,6 +14,10 @@ body.tts .mes_narrate {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body:not(.tts) #ttsExtensionNarrateAll {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
body.no-hotswap .hotswap,
|
body.no-hotswap .hotswap,
|
||||||
body.no-timer .mes_timer,
|
body.no-timer .mes_timer,
|
||||||
body.no-timestamps .timestamp,
|
body.no-timestamps .timestamp,
|
||||||
|
|
|
@ -348,13 +348,18 @@ function onAudioControlClicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAudioControl() {
|
function addAudioControl() {
|
||||||
|
|
||||||
$('#tts_wand_container').append(`
|
$('#tts_wand_container').append(`
|
||||||
<div id="ttsExtensionMenuItem" class="list-group-item flex-container flexGap5">
|
<div id="ttsExtensionMenuItem" class="list-group-item flex-container flexGap5">
|
||||||
<div id="tts_media_control" class="extensionsMenuExtensionButton "/></div>
|
<div id="tts_media_control" class="extensionsMenuExtensionButton "/></div>
|
||||||
TTS Playback
|
TTS Playback
|
||||||
</div>`);
|
</div>`);
|
||||||
|
$('#tts_wand_container').append(`
|
||||||
|
<div id="ttsExtensionNarrateAll" class="list-group-item flex-container flexGap5">
|
||||||
|
<div class="extensionsMenuExtensionButton fa-solid fa-radio"></div>
|
||||||
|
Narrate All Chat
|
||||||
|
</div>`);
|
||||||
$('#ttsExtensionMenuItem').attr('title', 'TTS play/pause').on('click', onAudioControlClicked);
|
$('#ttsExtensionMenuItem').attr('title', 'TTS play/pause').on('click', onAudioControlClicked);
|
||||||
|
$('#ttsExtensionNarrateAll').attr('title', 'Narrate all messages in the current chat. Includes user messages, excludes hidden comments.').on('click', playFullConversation);
|
||||||
updateUiAudioPlayState();
|
updateUiAudioPlayState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,12 +517,23 @@ async function processTtsQueue() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secret function for now
|
|
||||||
async function playFullConversation() {
|
async function playFullConversation() {
|
||||||
|
resetTtsPlayback();
|
||||||
|
|
||||||
|
if (!extension_settings.tts.enabled) {
|
||||||
|
return toastr.warning('TTS is disabled. Please enable it in the extension settings.');
|
||||||
|
}
|
||||||
|
|
||||||
const context = getContext();
|
const context = getContext();
|
||||||
const chat = context.chat;
|
const chat = context.chat.filter(x => !x.is_system && x.mes !== '...' && x.mes !== '');
|
||||||
|
|
||||||
|
if (chat.length === 0) {
|
||||||
|
return toastr.info('No messages to narrate.');
|
||||||
|
}
|
||||||
|
|
||||||
ttsJobQueue = chat;
|
ttsJobQueue = chat;
|
||||||
}
|
}
|
||||||
|
|
||||||
window['playFullConversation'] = playFullConversation;
|
window['playFullConversation'] = playFullConversation;
|
||||||
|
|
||||||
//#############################//
|
//#############################//
|
||||||
|
|
Loading…
Reference in New Issue