Merge branch 'main' into dev

This commit is contained in:
SillyLossy
2023-05-13 19:38:46 +03:00
4 changed files with 42 additions and 7 deletions

View File

@ -1,7 +1,7 @@
--- ---
name: Feature request name: Feature request
about: Suggest an idea for this project about: Suggest an idea for this project
title: '' title: "[Feature Request] "
labels: '' labels: ''
assignees: '' assignees: ''

View File

@ -10,6 +10,19 @@
"SillyTavern community Discord (support and discussion): https://discord.gg/RZdyAEUPvj" "SillyTavern community Discord (support and discussion): https://discord.gg/RZdyAEUPvj"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#@title <-- Tap this if you run on Mobile { display-mode: \"form\" }\n",
"#Taken from KoboldAI colab\n",
"%%html\n",
"<b>Press play on the audio player to keep the tab alive. (Uses only 13MB of data)</b><br/>\n",
"<audio src=\"https://henk.tech/colabkobold/silence.m4a\" controls>"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -42,10 +55,13 @@
"#@markdown Enables Silero text-to-speech module\n", "#@markdown Enables Silero text-to-speech module\n",
"extras_enable_sd = True #@param {type:\"boolean\"}\n", "extras_enable_sd = True #@param {type:\"boolean\"}\n",
"#@markdown Enables SD picture generation\n", "#@markdown Enables SD picture generation\n",
"SD_Model = \"ckpt/anything-v4.5-vae-swapped\" #@param [ \"ckpt/anything-v4.5-vae-swapped\", \"philz1337/clarity\", \"ckpt/sd15\" ]\n", "SD_Model = \"ckpt/anything-v4.5-vae-swapped\" #@param [ \"ckpt/anything-v4.5-vae-swapped\", \"hakurei/waifu-diffusion\", \"philz1337/clarity\", \"prompthero/openjourney\", \"ckpt/sd15\", \"stabilityai/stable-diffusion-2-1-base\" ]\n",
"#@markdown * ckpt/anything-v4.5-vae-swapped - anime style model\n", "#@markdown * ckpt/anything-v4.5-vae-swapped - anime style model\n",
"#@markdown * hakurei/waifu-diffusion - anime style model\n",
"#@markdown * philz1337/clarity - realistic style model\n", "#@markdown * philz1337/clarity - realistic style model\n",
"#@markdown * prompthero/openjourney - midjourney style model\n",
"#@markdown * ckpt/sd15 - base SD 1.5\n", "#@markdown * ckpt/sd15 - base SD 1.5\n",
"#@markdown * stabilityai/stable-diffusion-2-1-base - base SD 2.1\n",
"\n", "\n",
"import subprocess\n", "import subprocess\n",
"\n", "\n",

View File

@ -48,10 +48,8 @@ async function moduleWorker() {
return; return;
} }
// Chat/character/group changed // Chat changed
if ( if (
(context.groupId && lastGroupId !== context.groupId) ||
context.characterId !== lastCharacterId ||
context.chatId !== lastChatId context.chatId !== lastChatId
) { ) {
currentMessageNumber = context.chat.length ? context.chat.length : 0 currentMessageNumber = context.chat.length ? context.chat.length : 0
@ -241,9 +239,17 @@ async function processTtsQueue() {
console.debug('New message found, running TTS') console.debug('New message found, running TTS')
currentTtsJob = ttsJobQueue.shift() currentTtsJob = ttsJobQueue.shift()
const text = extension_settings.tts.narrate_dialogues_only let text = extension_settings.tts.narrate_dialogues_only
? currentTtsJob.mes.replace(/\*[^\*]*?(\*|$)/g, '').trim() // remove asterisks content ? currentTtsJob.mes.replace(/\*[^\*]*?(\*|$)/g, '').trim() // remove asterisks content
: currentTtsJob.mes.replaceAll('*', '').trim() // remove just the asterisks : currentTtsJob.mes.replaceAll('*', '').trim() // remove just the asterisks
if (extension_settings.tts.narrate_quoted_only) {
const special_quotes = /[“”]/g; // Extend this regex to include other special quotes
text = text.replace(special_quotes, '"');
const matches = text.match(/".*?"/g); // Matches text inside double quotes, non-greedily
text = matches ? matches.join(' ... ... ... ') : text;
}
console.log(`TTS: ${text}`)
const char = currentTtsJob.name const char = currentTtsJob.name
try { try {
@ -288,6 +294,7 @@ function loadSettings() {
extension_settings.tts.enabled extension_settings.tts.enabled
) )
$('#tts_narrate_dialogues').prop('checked', extension_settings.tts.narrate_dialogues_only) $('#tts_narrate_dialogues').prop('checked', extension_settings.tts.narrate_dialogues_only)
$('#tts_narrate_quoted').prop('checked', extension_settings.tts.narrate_quoted_only)
} }
const defaultSettings = { const defaultSettings = {
@ -380,6 +387,13 @@ function onNarrateDialoguesClick() {
saveSettingsDebounced() saveSettingsDebounced()
} }
function onNarrateQuotedClick() {
extension_settings.tts.narrate_quoted_only = $('#tts_narrate_quoted').prop('checked');
saveSettingsDebounced()
}
//##############// //##############//
// TTS Provider // // TTS Provider //
//##############// //##############//
@ -459,6 +473,10 @@ $(document).ready(function () {
<input type="checkbox" id="tts_narrate_dialogues"> <input type="checkbox" id="tts_narrate_dialogues">
Narrate dialogues only Narrate dialogues only
</label> </label>
<label class="checkbox_label" for="tts_narrate_quoted">
<input type="checkbox" id="tts_narrate_quoted">
Narrate quoted only
</label>
</div> </div>
<label>Voice Map</label> <label>Voice Map</label>
<textarea id="tts_voice_map" type="text" class="text_pole textarea_compact" rows="4" <textarea id="tts_voice_map" type="text" class="text_pole textarea_compact" rows="4"
@ -481,6 +499,7 @@ $(document).ready(function () {
$('#tts_apply').on('click', onApplyClick) $('#tts_apply').on('click', onApplyClick)
$('#tts_enabled').on('click', onEnableClick) $('#tts_enabled').on('click', onEnableClick)
$('#tts_narrate_dialogues').on('click', onNarrateDialoguesClick); $('#tts_narrate_dialogues').on('click', onNarrateDialoguesClick);
$('#tts_narrate_quoted').on('click', onNarrateQuotedClick);
$('#tts_voices').on('click', onTtsVoicesClick) $('#tts_voices').on('click', onTtsVoicesClick)
$('#tts_provider_settings').on('input', onTtsProviderSettingsInput) $('#tts_provider_settings').on('input', onTtsProviderSettingsInput)
for (const provider in ttsProviders) { for (const provider in ttsProviders) {

View File

@ -124,7 +124,7 @@ Get in touch with the developers directly:
### Windows ### Windows
Installing via Git (reccomended for easy updating) Installing via Git (recommended for easy updating)
Easy to follow guide with pretty pictures: Easy to follow guide with pretty pictures:
<https://docs.alpindale.dev/pygmalion-extras/sillytavern/#windows-installation> <https://docs.alpindale.dev/pygmalion-extras/sillytavern/#windows-installation>