mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'dev' of https://github.com/SillyLossy/TavernAI into dev
This commit is contained in:
@@ -160,7 +160,7 @@ async function connectToApi(baseUrl) {
|
||||
if (getExtensionsResult.ok) {
|
||||
const data = await getExtensionsResult.json();
|
||||
modules = data.modules;
|
||||
activateExtensions();
|
||||
await activateExtensions();
|
||||
}
|
||||
|
||||
updateStatus(getExtensionsResult.ok);
|
||||
@@ -273,12 +273,15 @@ async function loadExtensionSettings(settings) {
|
||||
}
|
||||
|
||||
$("#extensions_url").val(extension_settings.apiUrl);
|
||||
$("#extensions_autoconnect").prop('checked', extension_settings.autoConnect).trigger('input');
|
||||
$("#extensions_autoconnect").prop('checked', extension_settings.autoConnect);
|
||||
|
||||
// Activate offline extensions
|
||||
extensionNames = await discoverExtensions();
|
||||
manifests = await getManifests(extensionNames)
|
||||
activateExtensions();
|
||||
await activateExtensions();
|
||||
if (extension_settings.autoConnect && extension_settings.apiUrl) {
|
||||
await connectToApi(extension_settings.apiUrl);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(async function () {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { callPopup, saveSettingsDebounced } from '../../../script.js'
|
||||
import { callPopup, is_send_press, saveSettingsDebounced } from '../../../script.js'
|
||||
import { extension_settings, getContext } from '../../extensions.js'
|
||||
import { is_group_generating } from '../../group-chats.js'
|
||||
import { getStringHash } from '../../utils.js'
|
||||
import { ElevenLabsTtsProvider } from './elevenlabs.js'
|
||||
import { SileroTtsProvider } from './silerotts.js'
|
||||
@@ -43,6 +44,11 @@ async function moduleWorker() {
|
||||
return
|
||||
}
|
||||
|
||||
// Message is currently being generated
|
||||
if (is_send_press || is_group_generating) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Chat/character/group changed
|
||||
if (
|
||||
(context.groupId && lastGroupId !== context.groupId) ||
|
||||
@@ -115,7 +121,7 @@ async function playAudioData(audioBlob) {
|
||||
window['tts_preview'] = function (id) {
|
||||
const audio = document.getElementById(id)
|
||||
|
||||
if (!audio.hidden) {
|
||||
if (!$(audio).data('disabled')) {
|
||||
audio.play()
|
||||
}
|
||||
else {
|
||||
@@ -131,7 +137,7 @@ async function onTtsVoicesClick() {
|
||||
|
||||
for (const voice of voiceIds) {
|
||||
popupText += `<div class="voice_preview"><span class="voice_lang">${voice.lang || ''}</span> <b class="voice_name">${voice.name}</b> <i onclick="tts_preview('${voice.voice_id}')" class="fa-solid fa-play"></i></div>`
|
||||
popupText += `<audio id="${voice.voice_id}" src="${voice.preview_url}" hidden="${!!voice.preview_url}"></audio>`
|
||||
popupText += `<audio id="${voice.voice_id}" src="${voice.preview_url}" data-disabled="${voice.preview_url == false}"></audio>`
|
||||
}
|
||||
} catch {
|
||||
popupText = 'Could not load voices list. Check your API key.'
|
||||
|
@@ -87,7 +87,7 @@ class SystemTtsProvider {
|
||||
return speechSynthesis
|
||||
.getVoices()
|
||||
.sort((a, b) => a.lang.localeCompare(b.lang) || a.name.localeCompare(b.name))
|
||||
.map(x => ({ name: x.name, voice_id: x.voiceURI, preview_url: '', lang: x.lang }));
|
||||
.map(x => ({ name: x.name, voice_id: x.voiceURI, preview_url: false, lang: x.lang }));
|
||||
}
|
||||
|
||||
previewTtsVoice(voiceId) {
|
||||
|
@@ -449,11 +449,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, force_chid = null
|
||||
|
||||
const resolveOriginal = params.resolve;
|
||||
const rejectOriginal = params.reject;
|
||||
params.resolve = function() {
|
||||
params.resolve = function () {
|
||||
isQuietGenDone = true;
|
||||
resolveOriginal.apply(this, arguments);
|
||||
};
|
||||
params.reject = function() {
|
||||
params.reject = function () {
|
||||
isQuietGenDone = true;
|
||||
rejectOriginal.apply(this, arguments);
|
||||
}
|
||||
@@ -909,9 +909,11 @@ function select_group_chats(groupId, skipAnimation) {
|
||||
if (groupId) {
|
||||
$("#rm_group_submit").hide();
|
||||
$("#rm_group_delete").show();
|
||||
$("#rm_group_scenario").show();
|
||||
} else {
|
||||
$("#rm_group_submit").show();
|
||||
$("#rm_group_delete").hide();
|
||||
$("#rm_group_scenario").hide();
|
||||
}
|
||||
|
||||
$("#rm_group_delete").off();
|
||||
@@ -1264,11 +1266,35 @@ export async function saveGroupBookmarkChat(groupId, name, metadata) {
|
||||
});
|
||||
}
|
||||
|
||||
function setGroupScenario() {
|
||||
if (!selected_group) {
|
||||
return;
|
||||
}
|
||||
|
||||
const template = $('#group_scenario_template .group_scenario').clone();
|
||||
const metadataValue = chat_metadata['scenario'] || '';
|
||||
template.find('.group_chat_scenario').text(metadataValue);
|
||||
callPopup(template.get(0).outerHTML, 'text');
|
||||
}
|
||||
|
||||
function onGroupScenarioInput() {
|
||||
const value = $(this).val();
|
||||
const metadata = { scenario: value, };
|
||||
updateChatMetadata(metadata, false);
|
||||
}
|
||||
|
||||
function onGroupScenarioRemoveClick() {
|
||||
$(this).closest('.group_scenario').find('.group_chat_scenario').val('').trigger('input');
|
||||
}
|
||||
|
||||
jQuery(() => {
|
||||
$(document).on("click", ".group_select", selectGroup);
|
||||
$(document).on("input", ".group_chat_scenario", onGroupScenarioInput);
|
||||
$(document).on("click", ".remove_scenario_override", onGroupScenarioRemoveClick);
|
||||
$("#rm_group_filter").on("input", filterGroupMembers);
|
||||
$("#group_fav_filter").on("click", toggleFilterByFavorites);
|
||||
$("#rm_group_submit").on("click", createGroup);
|
||||
$("#rm_group_scenario").on("click", setGroupScenario);
|
||||
$("#rm_group_automode").on("input", function () {
|
||||
const value = $(this).prop("checked");
|
||||
is_group_automode_enabled = value;
|
||||
|
@@ -57,6 +57,7 @@ const send_on_enter_options = {
|
||||
|
||||
let power_user = {
|
||||
tokenizer: tokenizers.CLASSIC,
|
||||
token_padding: 64,
|
||||
collapse_newlines: false,
|
||||
pygmalion_formatting: pygmalion_options.AUTO,
|
||||
pin_examples: false,
|
||||
@@ -100,6 +101,7 @@ let power_user = {
|
||||
auto_fix_generated_markdown: true,
|
||||
send_on_enter: send_on_enter_options.AUTO,
|
||||
render_formulas: false,
|
||||
allow_name2_display: false,
|
||||
};
|
||||
|
||||
let themes = [];
|
||||
@@ -372,9 +374,11 @@ function loadPowerUserSettings(settings, data) {
|
||||
$("#play_message_sound").prop("checked", power_user.play_message_sound);
|
||||
$("#play_sound_unfocused").prop("checked", power_user.play_sound_unfocused);
|
||||
$("#auto_save_msg_edits").prop("checked", power_user.auto_save_msg_edits);
|
||||
$("#allow_name2_display").prop("checked", power_user.allow_name2_display);
|
||||
$(`input[name="avatar_style"][value="${power_user.avatar_style}"]`).prop("checked", true);
|
||||
$(`input[name="chat_display"][value="${power_user.chat_display}"]`).prop("checked", true);
|
||||
$(`input[name="sheld_width"][value="${power_user.sheld_width}"]`).prop("checked", true);
|
||||
$("#token_padding").val(power_user.token_padding);
|
||||
|
||||
$("#font_scale").val(power_user.font_scale);
|
||||
$("#font_scale_counter").text(power_user.font_scale);
|
||||
@@ -747,6 +751,17 @@ $(document).ready(() => {
|
||||
saveSettingsDebounced();
|
||||
})
|
||||
|
||||
$("#allow_name2_display").on("input", function () {
|
||||
power_user.allow_name2_display = !!$(this).prop('checked');
|
||||
reloadCurrentChat();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#token_padding").on("input", function () {
|
||||
power_user.token_padding = Number($(this).val());
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(window).on('focus', function () {
|
||||
browser_has_focus = true;
|
||||
});
|
||||
|
Reference in New Issue
Block a user