Merge branch 'staging' of https://github.com/SillyTavern/SillyTavern into staging

This commit is contained in:
Cohee
2023-08-30 12:03:38 +03:00
9 changed files with 73 additions and 54 deletions

16
jsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "node",
"strictNullChecks": true,
"strictFunctionTypes": true,
"checkJs": true,
"allowUmdGlobalAccess": true,
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "sillytavern", "name": "sillytavern",
"version": "1.9.7", "version": "1.10.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "sillytavern", "name": "sillytavern",
"version": "1.9.7", "version": "1.10.0",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@agnai/sentencepiece-js": "^1.1.1", "@agnai/sentencepiece-js": "^1.1.1",

View File

@ -51,7 +51,7 @@
"type": "git", "type": "git",
"url": "https://github.com/SillyTavern/SillyTavern.git" "url": "https://github.com/SillyTavern/SillyTavern.git"
}, },
"version": "1.9.7", "version": "1.10.0",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"start-multi": "node server.js --disableCsrf", "start-multi": "node server.js --disableCsrf",

View File

@ -863,8 +863,8 @@
</div> </div>
</div> </div>
</div> </div>
<hr data-source="openai,claude">
<div class="range-block" data-source="openai,claude"> <div class="range-block" data-source="openai,claude">
<hr>
<div class="range-block-title justifyLeft" data-i18n="OpenAI Reverse Proxy"> <div class="range-block-title justifyLeft" data-i18n="OpenAI Reverse Proxy">
OpenAI / Claude Reverse Proxy OpenAI / Claude Reverse Proxy
</div> </div>
@ -2467,7 +2467,7 @@
</div> </div>
</div> </div>
<div class="flex2 flex-container flexFlowColumn"> <div class="flex2 flex-container flexFlowColumn">
<div class="flex range-block"> <div data-newbie-hidden class="flex range-block">
<div class="range-block-title justifyLeft"> <div class="range-block-title justifyLeft">
<label for="world_info_character_strategy"> <label for="world_info_character_strategy">
<span data-i18n="Character Lore Insertion Strategy"><small>Character Lore Insertion Strategy</small></span> <span data-i18n="Character Lore Insertion Strategy"><small>Character Lore Insertion Strategy</small></span>
@ -2483,7 +2483,7 @@
</div> </div>
<div name="WIScanAndTokens" class="flex1 flex-container flexFlowColumn"> <div name="WIScanAndTokens" class="flex1 flex-container flexFlowColumn">
<div class="flex1 gap5px range-block"> <div data-newbie-hidden class="flex1 gap5px range-block">
<div class="wide10pMinFit"> <div class="wide10pMinFit">
<small data-i18n="Scan Depth">Scan Depth</small> <small data-i18n="Scan Depth">Scan Depth</small>
</div> </div>
@ -2515,7 +2515,7 @@
</div> </div>
</div> </div>
<div class="flex1 gap5px range-block"> <div data-newbie-hidden class="flex1 gap5px range-block">
<div class="wide10pMinFit"> <div class="wide10pMinFit">
<small data-i18n="Budget Cap">Budget Cap</small> <small data-i18n="Budget Cap">Budget Cap</small>
</div> </div>
@ -2536,7 +2536,7 @@
</div> </div>
</div> </div>
<div class="alignitemsflexstart flex1 range-block flex-container flexFlowColumn"> <div data-newbie-hidden class="alignitemsflexstart flex1 range-block flex-container flexFlowColumn">
<label title="Entries can activate other entries by mentioning their keywords" data-i18n="[title]Entries can activate other entries by mentioning their keywords" class="checkbox_label"> <label title="Entries can activate other entries by mentioning their keywords" data-i18n="[title]Entries can activate other entries by mentioning their keywords" class="checkbox_label">
<input id="world_info_recursive" type="checkbox" /> <input id="world_info_recursive" type="checkbox" />
<small data-i18n="Recursive Scan"> <small data-i18n="Recursive Scan">
@ -3084,12 +3084,14 @@
<div class="extension_token_counter"> <div class="extension_token_counter">
Tokens: <span id="persona_description_token_count">0</span> Tokens: <span id="persona_description_token_count">0</span>
</div> </div>
<label for="persona_description_position" data-i18n="Position:">Position:</label> <div data-newbie-hidden>
<select id="persona_description_position"> <label for="persona_description_position" data-i18n="Position:">Position:</label>
<option value="0" data-i18n="In Story String / Prompt Manager">In Story String / Prompt Manager</option> <select id="persona_description_position">
<option value="2" data-i18n="Top of Author's Note">Top of Author's Note</option> <option value="0" data-i18n="In Story String / Prompt Manager">In Story String / Prompt Manager</option>
<option value="3" data-i18n="Bottom of Author's Note">Bottom of Author's Note</option> <option value="2" data-i18n="Top of Author's Note">Top of Author's Note</option>
</select> <option value="3" data-i18n="Bottom of Author's Note">Bottom of Author's Note</option>
</select>
</div>
</div> </div>
<div class="range-block"> <div class="range-block">
<label for="persona_show_notifications" class="checkbox_label"> <label for="persona_show_notifications" class="checkbox_label">
@ -3103,9 +3105,9 @@
<div class="flex1"> <div class="flex1">
<h4 class="title_restorable"> <h4 class="title_restorable">
<span data-i18n="Your Persona">Your Persona</span> <span data-i18n="Your Persona">Your Persona</span>
<button class="menu_button menu_button_icon user_stats_button" title="Click for stats!"> <div class="menu_button menu_button_icon user_stats_button" title="Click for stats!">
<i class="fa-solid fa-circle-info"></i><span data-i18n="Usage Stats">Usage Stats</span> <i class="fa-solid fa-ranking-star"></i><span data-i18n="Usage Stats">Usage Stats</span>
</button> </div>
<div id="create_dummy_persona" class="menu_button menu_button_icon" title="Create a dummy persona" data-i18n="[title]Create a dummy persona"> <div id="create_dummy_persona" class="menu_button menu_button_icon" title="Create a dummy persona" data-i18n="[title]Create a dummy persona">
<i class="fa-solid fa-person-circle-question fa-fw"></i> <i class="fa-solid fa-person-circle-question fa-fw"></i>
<span data-i18n="Blank">Blank</span> <span data-i18n="Blank">Blank</span>

View File

@ -2801,11 +2801,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
return; return;
} }
const anchorDepth = Math.abs(index - finalMesSend.length + 1); const anchorDepth = Math.abs(index - finalMesSend.length);
// NOTE: Depth injected here! // NOTE: Depth injected here!
const extensionAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, anchorDepth); const extensionAnchor = getExtensionPrompt(extension_prompt_types.IN_CHAT, anchorDepth);
if (anchorDepth > 0 && extensionAnchor && extensionAnchor.length) { if (anchorDepth >= 0 && extensionAnchor && extensionAnchor.length) {
mesItem.extensionPrompts.push(extensionAnchor); mesItem.extensionPrompts.push(extensionAnchor);
} }
}); });

View File

@ -607,10 +607,6 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
eventSource.on(event_types.OAI_PRESET_CHANGED, settings => { eventSource.on(event_types.OAI_PRESET_CHANGED, settings => {
// Save configuration and wrap everything up. // Save configuration and wrap everything up.
this.saveServiceSettings().then(() => { this.saveServiceSettings().then(() => {
this.hidePopup();
this.clearEditForm();
this.renderDebounced();
const mainPrompt = this.getPromptById('main'); const mainPrompt = this.getPromptById('main');
this.updateQuickEdit('main', mainPrompt); this.updateQuickEdit('main', mainPrompt);
@ -619,6 +615,10 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
const jailbreakPrompt = this.getPromptById('jailbreak'); const jailbreakPrompt = this.getPromptById('jailbreak');
this.updateQuickEdit('jailbreak', jailbreakPrompt); this.updateQuickEdit('jailbreak', jailbreakPrompt);
this.hidePopup();
this.clearEditForm();
this.renderDebounced();
}); });
}); });

View File

@ -1,26 +1,26 @@
#roll_dice { #roll_dice {
/* order: 100; */ /* order: 100; */
/* width: 40px; /* width: 40px;
height: 40px; height: 40px;
margin: 0; margin: 0;
padding: 1px; */ padding: 1px; */
outline: none; outline: none;
border: none; border: none;
cursor: pointer; cursor: pointer;
transition: 0.3s; transition: 0.3s;
opacity: 0.7; opacity: 0.7;
display: flex; display: flex;
align-items: center; align-items: center;
/* justify-content: center; */ /* justify-content: center; */
} }
#roll_dice:hover { #roll_dice:hover {
opacity: 1; opacity: 1;
filter: brightness(1.2); filter: brightness(1.2);
} }
#dice_dropdown { #dice_dropdown {
z-index: 100; z-index: 30000;
backdrop-filter: blur(--SmartThemeBlurStrength); backdrop-filter: blur(--SmartThemeBlurStrength);
} }

View File

@ -394,6 +394,11 @@ function onExpressionsShowDefaultInput() {
} }
async function unloadLiveChar() { async function unloadLiveChar() {
if (!modules.includes('talkinghead')) {
console.debug('talkinghead module is disabled');
return;
}
try { try {
const url = new URL(getApiUrl()); const url = new URL(getApiUrl());
url.pathname = '/api/talkinghead/unload'; url.pathname = '/api/talkinghead/unload';

View File

@ -24,7 +24,6 @@ function createDefaultFiles() {
} }
} }
const process = require('process')
const yargs = require('yargs/yargs'); const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers'); const { hideBin } = require('yargs/helpers');
const net = require("net"); const net = require("net");
@ -149,11 +148,8 @@ let api_openai = "https://api.openai.com/v1";
let api_claude = "https://api.anthropic.com/v1"; let api_claude = "https://api.anthropic.com/v1";
let main_api = "kobold"; let main_api = "kobold";
let response_generate_novel;
let characters = {}; let characters = {};
let response_dw_bg; let response_dw_bg;
let first_run = true;
let color = { let color = {
byNum: (mess, fgNum) => { byNum: (mess, fgNum) => {
@ -4134,7 +4130,7 @@ function backupSettings() {
const backupFile = path.join(directories.backups, `settings_${generateTimestamp()}.json`); const backupFile = path.join(directories.backups, `settings_${generateTimestamp()}.json`);
fs.copyFileSync(SETTINGS_FILE, backupFile); fs.copyFileSync(SETTINGS_FILE, backupFile);
let files = fs.readdirSync(directories.backups); let files = fs.readdirSync(directories.backups).filter(f => f.startsWith('settings_'));
if (files.length > MAX_BACKUPS) { if (files.length > MAX_BACKUPS) {
files = files.map(f => path.join(directories.backups, f)); files = files.map(f => path.join(directories.backups, f));
files.sort((a, b) => fs.statSync(a).mtimeMs - fs.statSync(b).mtimeMs); files.sort((a, b) => fs.statSync(a).mtimeMs - fs.statSync(b).mtimeMs);