mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-10 09:00:14 +01:00
Merge branch 'staging' of https://github.com/Cohee1207/SillyTavern into staging
This commit is contained in:
commit
f892931d44
1
.github/readme-zh_cn.md
vendored
1
.github/readme-zh_cn.md
vendored
@ -291,6 +291,7 @@ SillyTavern 会将 API 密钥保存在目录中的 `secrets.json` 文件内。
|
||||
* RossAscends' additions: AGPL v3
|
||||
* Portions of CncAnon's TavernAITurbo mod: Unknown license
|
||||
* kingbri's various commits and suggestions (https://github.com/bdashore3)
|
||||
* StefanDanielSchwarz's various commits and bug reports (https://github.com/StefanDanielSchwarz)
|
||||
* Waifu mode inspired by the work of PepperTaco (https://github.com/peppertaco/Tavern/)
|
||||
* Thanks Pygmalion University for being awesome testers and suggesting cool features!
|
||||
* Thanks oobabooga for compiling presets for TextGen
|
||||
|
1
.github/readme.md
vendored
1
.github/readme.md
vendored
@ -293,6 +293,7 @@ GNU Affero General Public License for more details.**
|
||||
* RossAscends' additions: AGPL v3
|
||||
* Portions of CncAnon's TavernAITurbo mod: Unknown license
|
||||
* kingbri's various commits and suggestions (<https://github.com/bdashore3>)
|
||||
* StefanDanielSchwarz's various commits and bug reports (<https://github.com/StefanDanielSchwarz>)
|
||||
* Waifu mode inspired by the work of PepperTaco (<https://github.com/peppertaco/Tavern/>)
|
||||
* Thanks Pygmalion University for being awesome testers and suggesting cool features!
|
||||
* Thanks oobabooga for compiling presets for TextGen
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"genamt": 300,
|
||||
"max_length": 4096,
|
||||
"max_length": 2048,
|
||||
"temp": 0,
|
||||
"rep_pen": 1.1,
|
||||
"rep_pen_range": 4096,
|
||||
"rep_pen_range": 2048,
|
||||
"streaming_kobold": true,
|
||||
"top_p": 0,
|
||||
"top_a": 0,
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"genamt": 250,
|
||||
"max_length": 4096,
|
||||
"max_length": 2048,
|
||||
"temp": 0.65,
|
||||
"rep_pen": 1.18,
|
||||
"rep_pen_range": 4096,
|
||||
"rep_pen_range": 2048,
|
||||
"streaming_kobold": true,
|
||||
"top_p": 0.47,
|
||||
"top_a": 0,
|
||||
|
@ -2639,6 +2639,14 @@
|
||||
<option value="3" data-i18n="Bottom of Author's Note">Bottom of Author's Note</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<label for="persona_show_notifications" class="checkbox_label">
|
||||
<input id="persona_show_notifications" type="checkbox" />
|
||||
<span data-i18n="Show Notifications Show notifications on switching personas">
|
||||
Show notifications on switching personas
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex1">
|
||||
<h4 class="title_restorable">
|
||||
|
@ -4554,7 +4554,9 @@ export function setUserName(value) {
|
||||
name1 = default_user_name;
|
||||
console.log(`User name changed to ${name1}`);
|
||||
$("#your_name").val(name1);
|
||||
toastr.success(`Your messages will now be sent as ${name1}`, 'Current persona updated');
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.success(`Your messages will now be sent as ${name1}`, 'Current persona updated');
|
||||
}
|
||||
saveSettings("change_name");
|
||||
}
|
||||
|
||||
@ -4653,7 +4655,7 @@ function setUserAvatar() {
|
||||
const personaName = power_user.personas[user_avatar];
|
||||
if (personaName && name1 !== personaName) {
|
||||
const lockedPersona = chat_metadata['persona'];
|
||||
if (lockedPersona && lockedPersona !== user_avatar) {
|
||||
if (lockedPersona && lockedPersona !== user_avatar && power_user.persona_show_notifications) {
|
||||
toastr.info(
|
||||
`To permanently set "${personaName}" as the selected persona, unlock and relock it using the "Lock" button. Otherwise, the selection resets upon reloading the chat.`,
|
||||
`This chat is locked to a different persona (${power_user.personas[lockedPersona]}).`,
|
||||
@ -4760,7 +4762,9 @@ async function setDefaultPersona() {
|
||||
}
|
||||
|
||||
console.log(`Removing default persona ${avatarId}`);
|
||||
toastr.info('This persona will no longer be used by default when you open a new chat.', `Default persona removed`);
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.info('This persona will no longer be used by default when you open a new chat.', `Default persona removed`);
|
||||
}
|
||||
delete power_user.default_persona;
|
||||
} else {
|
||||
const confirm = await callPopup(`<h3>Are you sure you want to set "${personaName}" as the default persona?</h3>
|
||||
@ -4772,7 +4776,9 @@ async function setDefaultPersona() {
|
||||
}
|
||||
|
||||
power_user.default_persona = avatarId;
|
||||
toastr.success('This persona will be used by default when you open a new chat.', `Default persona set to ${personaName}`);
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.success('This persona will be used by default when you open a new chat.', `Default persona set to ${personaName}`);
|
||||
}
|
||||
}
|
||||
|
||||
saveSettingsDebounced();
|
||||
@ -4835,18 +4841,22 @@ function lockUserNameToChat() {
|
||||
console.log(`Unlocking persona for this chat ${chat_metadata['persona']}`);
|
||||
delete chat_metadata['persona'];
|
||||
saveMetadata();
|
||||
toastr.info('User persona is now unlocked for this chat. Click the "Lock" again to revert.', 'Persona unlocked');
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.info('User persona is now unlocked for this chat. Click the "Lock" again to revert.', 'Persona unlocked');
|
||||
}
|
||||
updateUserLockIcon();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(user_avatar in power_user.personas)) {
|
||||
console.log(`Creating a new persona ${user_avatar}`);
|
||||
toastr.info(
|
||||
'Creating a new persona for currently selected user name and avatar...',
|
||||
'Persona not set for this avatar',
|
||||
{ timeOut: 10000, extendedTimeOut: 20000, },
|
||||
);
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.info(
|
||||
'Creating a new persona for currently selected user name and avatar...',
|
||||
'Persona not set for this avatar',
|
||||
{ timeOut: 10000, extendedTimeOut: 20000, },
|
||||
);
|
||||
}
|
||||
power_user.personas[user_avatar] = name1;
|
||||
power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.BEFORE_CHAR };
|
||||
}
|
||||
@ -4855,7 +4865,9 @@ function lockUserNameToChat() {
|
||||
saveMetadata();
|
||||
saveSettingsDebounced();
|
||||
console.log(`Locking persona for this chat ${user_avatar}`);
|
||||
toastr.success(`User persona is locked to ${name1} in this chat`);
|
||||
if (power_user.persona_show_notifications) {
|
||||
toastr.success(`User persona is locked to ${name1} in this chat`);
|
||||
}
|
||||
updateUserLockIcon();
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@ let lastCharacter = undefined;
|
||||
let lastMessage = null;
|
||||
let spriteCache = {};
|
||||
let inApiCall = false;
|
||||
let live2d_var = false;
|
||||
let previousSrc = null;
|
||||
|
||||
|
||||
@ -448,8 +447,7 @@ async function loadLiveChar() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleImageChange(isChecked) {
|
||||
function handleImageChange() {
|
||||
const imgElement = document.querySelector('img#expression-image.expression');
|
||||
|
||||
if (!imgElement) {
|
||||
@ -457,31 +455,32 @@ function handleImageChange(isChecked) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isChecked) {
|
||||
if (extension_settings.expressions.live2d) {
|
||||
previousSrc = imgElement.src;
|
||||
// Method get IP of endpoint
|
||||
if (imgElement.src !== getApiUrl() + '/api/live2d/result_feed') {
|
||||
const expressionListItemElement = document.querySelector('#live2d');
|
||||
const expressionImageElement = expressionListItemElement.querySelector('.expression_list_image');
|
||||
const newSrc = expressionImageElement.src;
|
||||
const live2dResultFeedSrc = `${getApiUrl()}/api/live2d/result_feed`;
|
||||
$('#expression-holder').css({ display: '' });
|
||||
if (imgElement.src !== live2dResultFeedSrc) {
|
||||
const expressionImageElement = document.querySelector('.expression_list_image');
|
||||
|
||||
doExtrasFetch(newSrc, {
|
||||
method: 'HEAD',
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
|
||||
}
|
||||
if (expressionImageElement) {
|
||||
doExtrasFetch(expressionImageElement.src, {
|
||||
method: 'HEAD',
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error); // Log the error if necessary
|
||||
});
|
||||
} else if (previousSrc) {
|
||||
imgElement.src = previousSrc; // Revert the src to its previous value
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
imgElement.src = live2dResultFeedSrc;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(error); // Log the error if necessary
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (previousSrc !== null) {
|
||||
imgElement.src = previousSrc; // Revert the src to its previous value
|
||||
} else {
|
||||
imgElement.src = ""; //remove incase char doesnt have expressions
|
||||
setExpression(getContext().name2, FALLBACK_EXPRESSION, true);
|
||||
}
|
||||
live2d_var = isChecked;
|
||||
}
|
||||
|
||||
async function moduleWorker() {
|
||||
@ -497,22 +496,16 @@ async function moduleWorker() {
|
||||
if (context.groupId !== lastCharacter && context.characterId !== lastCharacter) {
|
||||
removeExpression();
|
||||
spriteCache = {};
|
||||
|
||||
previousSrc = null;
|
||||
|
||||
//uncheck live image
|
||||
let checkbox = document.getElementById('image_type_toggle');
|
||||
if (checkbox.checked) {
|
||||
checkbox.click();
|
||||
}
|
||||
|
||||
//clear expression
|
||||
let imgElement = document.getElementById('expression-image');
|
||||
imgElement.src = "";
|
||||
|
||||
//Load new char
|
||||
if (live2d_var) {
|
||||
loadLiveChar();
|
||||
//set checkbox to global var
|
||||
$('#image_type_toggle').prop('checked', extension_settings.expressions.live2d);
|
||||
if(extension_settings.expressions.live2d == true){
|
||||
setLive2dState(extension_settings.expressions.live2d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -618,6 +611,14 @@ async function moduleWorker() {
|
||||
}
|
||||
}
|
||||
|
||||
function setLive2dState(switch_var){
|
||||
extension_settings.expressions.live2d = switch_var; // Store setting
|
||||
saveSettingsDebounced();
|
||||
|
||||
if (extension_settings.expressions.live2d) { loadLiveChar(); } // load char as needed
|
||||
handleImageChange(switch_var); // Change image as needed
|
||||
}
|
||||
|
||||
function getSpriteFolderName(message) {
|
||||
const context = getContext();
|
||||
let avatarPath = '';
|
||||
@ -805,7 +806,7 @@ async function getExpressionsList() {
|
||||
}
|
||||
|
||||
async function setExpression(character, expression, force) {
|
||||
if (live2d_var == false) {
|
||||
if (extension_settings.expressions.live2d == false) {
|
||||
|
||||
console.debug('entered setExpressions');
|
||||
await validateImages(character);
|
||||
@ -915,7 +916,7 @@ async function setExpression(character, expression, force) {
|
||||
}
|
||||
document.getElementById("expression-holder").style.display = '';
|
||||
|
||||
if (live2d_var == true) {
|
||||
} else {
|
||||
// Find the <img> element with id="expression-image" and class="expression"
|
||||
const imgElement = document.querySelector('img#expression-image.expression');
|
||||
//console.log("searching");
|
||||
@ -923,7 +924,6 @@ async function setExpression(character, expression, force) {
|
||||
console.log("setting value");
|
||||
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1234,13 +1234,8 @@ function setExpressionOverrideHtml(forceClear = false) {
|
||||
$(window).on("resize", updateVisualNovelModeDebounced);
|
||||
$('.expression_settings').hide();
|
||||
|
||||
|
||||
$('#image_type_toggle').on('change', function () {
|
||||
const isChecked = this.checked;
|
||||
if (isChecked) {
|
||||
loadLiveChar();
|
||||
}
|
||||
handleImageChange(isChecked);
|
||||
$('#image_type_toggle').on('click', function () {
|
||||
setLive2dState(this.checked);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1253,7 +1248,6 @@ function setExpressionOverrideHtml(forceClear = false) {
|
||||
moduleWorker();
|
||||
dragElement($("#expression-holder"))
|
||||
eventSource.on(event_types.CHAT_CHANGED, () => {
|
||||
//console.log("checked: " + live2d_var);
|
||||
setExpressionOverrideHtml();
|
||||
|
||||
if (isVisualNovelMode()) {
|
||||
|
@ -27,7 +27,7 @@ import {
|
||||
|
||||
import { registerSlashCommand } from "./slash-commands.js";
|
||||
|
||||
import { delay, debounce } from "./utils.js";
|
||||
import { delay } from "./utils.js";
|
||||
|
||||
export {
|
||||
loadPowerUserSettings,
|
||||
@ -184,6 +184,7 @@ let power_user = {
|
||||
|
||||
persona_description: '',
|
||||
persona_description_position: persona_description_positions.BEFORE_CHAR,
|
||||
persona_show_notifications: true,
|
||||
|
||||
custom_stopping_strings: '',
|
||||
fuzzy_search: false,
|
||||
@ -678,6 +679,7 @@ function loadPowerUserSettings(settings, data) {
|
||||
$('#auto_swipe_blacklist_threshold').val(power_user.auto_swipe_blacklist_threshold);
|
||||
$('#custom_stopping_strings').val(power_user.custom_stopping_strings);
|
||||
$('#fuzzy_search_checkbox').prop("checked", power_user.fuzzy_search);
|
||||
$('#persona_show_notifications').prop("checked", power_user.persona_show_notifications);
|
||||
|
||||
$("#console_log_prompts").prop("checked", power_user.console_log_prompts);
|
||||
$('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown);
|
||||
@ -1998,6 +2000,11 @@ $(document).ready(() => {
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#persona_show_notifications').on('input', function () {
|
||||
power_user.persona_show_notifications = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$(window).on('focus', function () {
|
||||
browser_has_focus = true;
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user