Merge branch 'SillyTavern:staging' into staging

This commit is contained in:
Tony-sama 2023-08-10 15:23:56 +02:00 committed by GitHub
commit 9e2ebdb43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 135 additions and 69 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "sillytavern",
"version": "1.9.6",
"version": "1.9.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sillytavern",
"version": "1.9.6",
"version": "1.9.7",
"license": "AGPL-3.0",
"dependencies": {
"@dqbd/tiktoken": "^1.0.2",

View File

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

View File

@ -787,21 +787,45 @@
</label>
</div>
<div class="range-block flexFlowColumn">
<div class="range-block-title" data-i18n="Samplers Order">
Samplers Order
<div class="range-block-title">
<span data-i18n="Samplers Order">Samplers Order</span>
</div>
<div class="toggle-description" data-i18n="Samplers will be applied in a top-down order. Use with caution.">
Samplers will be applied in a top-down order.
Use with caution.
</div>
<div id="kobold_order">
<div data-id="0" data-i18n="Top K">Top K</div>
<div data-id="1" data-i18n="Top A">Top A</div>
<div data-id="2" data-i18n="Top P">Top P</div>
<div data-id="3" data-i18n="Tail Free Sampling">Tail Free Sampling</div>
<div data-id="4" data-i18n="Typical Sampling">Typical Sampling</div>
<div data-id="5" data-i18n="Temperature">Temperature</div>
<div data-id="6" data-i18n="Repetition Penalty">Repetition Penalty</div>
<div data-id="0">
<span data-i18n="Top K">Top K</span>
<small>0</small>
</div>
<div data-id="1">
<span data-i18n="Top A">Top A</span>
<small>1</small>
</div>
<div data-id="2">
<span data-i18n="Top P">Top P</span>
<small>2</small>
</div>
<div data-id="3">
<span data-i18n="Tail Free Sampling">Tail Free Sampling</span>
<small>3</small>
</div>
<div data-id="4">
<span data-i18n="Typical Sampling">Typical Sampling</span>
<small>4</small>
</div>
<div data-id="5">
<span data-i18n="Temperature">Temperature</span>
<small>5</small>
</div>
<div data-id="6">
<span data-i18n="Repetition Penalty">Repetition Penalty</span>
<small>6</small>
</div>
</div>
<div id="samplers_order_recommended" class="menu_button menu_button_icon">
<span data-i18n="Load koboldcpp order">Load koboldcpp order</span>
</div>
</div>
</div>
@ -1751,7 +1775,7 @@
<option data-i18n="Connect to the API">-- Connect to the API --</option>
</select>
<small>
Max prompt cost: <span id="openrouter_max_prompt_cost">Unknown</span> <span id="openrouter_max_prompt_cost_currency">USD</span>
Max prompt cost: <span id="openrouter_max_prompt_cost">Unknown</span>
</small>
</div>
<h4 data-i18n="OpenRouter API Key">OpenRouter API Key</h4>
@ -2482,11 +2506,11 @@
<div id="power-user-options-block" class="flex-container drawer33pWidth">
<div id="power-user-option-checkboxes">
<h4 data-i18n="Power User Options">Power User Options</h4>
<label for="swipes-checkbox">
<label class="checkbox_label" for="swipes-checkbox">
<input id="swipes-checkbox" type="checkbox" />
<span data-i18n="Swipes">Swipes</span>
</label>
<label for="fuzzy_search_checkbox">
<label class="checkbox_label" for="fuzzy_search_checkbox">
<input id="fuzzy_search_checkbox" type="checkbox" />
<span data-i18n="Advanced Character Search">Advanced Character Search</span>
</label>
@ -2504,13 +2528,15 @@
Press "Send" to continue
</span>
</label>
<label for="auto-load-chat-checkbox"><input id="auto-load-chat-checkbox" type="checkbox" />
<label class="checkbox_label" for="auto-load-chat-checkbox">
<input id="auto-load-chat-checkbox" type="checkbox" />
<span data-i18n="Auto-load Last Chat">Auto-load Last Chat</span>
</label>
<label for="auto_save_msg_edits"><input id="auto_save_msg_edits" type="checkbox" />
<label class="checkbox_label" for="auto_save_msg_edits">
<input id="auto_save_msg_edits" type="checkbox" />
<span data-i18n="Auto-save Message Edits">Auto-save Message Edits</span>
</label>
<label for="auto_fix_generated_markdown">
<label class="checkbox_label" for="auto_fix_generated_markdown">
<input id="auto_fix_generated_markdown" type="checkbox" />
<span data-i18n="Auto-fix Markdown">Auto-fix Markdown</span>
</label>
@ -2522,37 +2548,43 @@
<input id="allow_name1_display" type="checkbox" />
<span data-i18n="Allow {{user}}: in bot messages">Show {{user}}: in responses</span>
</label>
<!-- <label class="checkbox_label" for="removeXML">
<input id="removeXML" type="checkbox" />
<span data-i18n="Remove XML/HTML tags from responses">Remove &lt;tags&gt; from responses</span>
</label> -->
<label for="console_log_prompts">
<label class="checkbox_label" for="encode_tags">
<input id="encode_tags" type="checkbox" />
<span data-i18n="Show tags in responses">Show &lt;tags&gt; in responses</span>
</label>
<label class="checkbox_label" for="console_log_prompts">
<input id="console_log_prompts" type="checkbox" />
<span data-i18n="Log prompts to console">Log prompts to console</span>
</label>
<label for="render_formulas">
<label class="checkbox_label" for="render_formulas">
<input id="render_formulas" type="checkbox" />
<span data-i18n="Render Formulas">Render Formulas</span>
<a href="https://docs.sillytavern.app/usage/core-concepts/uicustomization/#formulas-rendering" class="notes-link" target="_blank">
<span class="note-link-span">?</span>
</a>
</label>
<label for="never_resize_avatars"><input id="never_resize_avatars" type="checkbox" />
<label class="checkbox_label" for="never_resize_avatars">
<input id="never_resize_avatars" type="checkbox" />
<span data-i18n="Never resize avatars">Never resize avatars</span>
</label>
<label for="show_card_avatar_urls"><input id="show_card_avatar_urls" type="checkbox" />
<label class="checkbox_label" for="show_card_avatar_urls">
<input id="show_card_avatar_urls" type="checkbox" />
<span data-i18n="Show avatar filenames">Show avatar filenames</span>
</label>
<label for="import_card_tags"><input id="import_card_tags" type="checkbox" />
<label class="checkbox_label" for="import_card_tags">
<input id="import_card_tags" type="checkbox" />
<span data-i18n="Import Card Tags">Import Card Tags</span>
</label>
<label for="confirm_message_delete"><input id="confirm_message_delete" type="checkbox" />
<label class="checkbox_label" for="confirm_message_delete">
<input id="confirm_message_delete" type="checkbox" />
<span data-i18n="Confirm message deletion">Confirm message deletion</span>
</label>
<label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
<label class="checkbox_label" for="spoiler_free_mode">
<input id="spoiler_free_mode" type="checkbox" />
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
</label>
<label for="relaxed_api_urls" title="Reduce the formatting requirements on API URLS"><input id="relaxed_api_urls" type="checkbox" />
<label class="checkbox_label" for="relaxed_api_urls" title="Reduce the formatting requirements on API URLS">
<input id="relaxed_api_urls" type="checkbox" />
<span data-i18n="Relaxed API URLS">Relaxed API URLS</span>
</label>

View File

@ -679,6 +679,7 @@ function reloadMarkdownProcessor(render_formulas = false) {
converter = new showdown.Converter({
emoji: "true",
underline: "true",
tables: "true",
parseImgDimensions: "true",
extensions: [
showdownKatex(
@ -696,6 +697,7 @@ function reloadMarkdownProcessor(render_formulas = false) {
emoji: "true",
literalMidWordUnderscores: "true",
parseImgDimensions: "true",
tables: "true",
});
}
@ -1269,8 +1271,10 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
mes = fixMarkdown(mes);
}
//if (this_chid != undefined && !isSystem)
// mes = mes.replaceAll("<", "&lt;").replaceAll(">", "&gt;"); //for welcome message
if (!isSystem && power_user.encode_tags) {
mes = mes.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
}
if ((this_chid === undefined || this_chid === "invalid-safety-id") && !selected_group) {
mes = mes
.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>")

View File

@ -515,7 +515,7 @@ async function moduleWorker() {
//set checkbox to global var
$('#image_type_toggle').prop('checked', extension_settings.expressions.live2d);
if(extension_settings.expressions.live2d == true){
if (extension_settings.expressions.live2d) {
setLive2dState(extension_settings.expressions.live2d);
}
}
@ -641,11 +641,11 @@ async function live2dcheck() {
let live2dObj = spriteCache[spriteFolderName].find(obj => obj.label === 'live2d');
let live2dPath_f = live2dObj ? live2dObj.path : null;
if(live2dPath_f != null){
if (live2dPath_f != null) {
//console.log("live2dPath_f " + live2dPath_f);
return true;
} else {
//console.log("live2dPath_f is null");
} else {
//console.log("live2dPath_f is null");
unloadLiveChar();
return false;
}
@ -654,7 +654,7 @@ async function live2dcheck() {
}
}
function setLive2dState(switch_var){
function setLive2dState(switch_var) {
extension_settings.expressions.live2d = switch_var; // Store setting
saveSettingsDebounced();
@ -662,22 +662,18 @@ function setLive2dState(switch_var){
if (result) {
//console.log("Live2d exists!");
if (extension_settings.expressions.live2d) {
loadLiveChar();
} else {
unloadLiveChar();
}
handleImageChange(switch_var); // Change image as needed
if (extension_settings.expressions.live2d) {
loadLiveChar();
} else {
unloadLiveChar();
}
handleImageChange(switch_var); // Change image as needed
} else {
//console.log("Live2d does not exist.");
}
});
}
function getSpriteFolderName(message) {
@ -867,8 +863,7 @@ async function getExpressionsList() {
}
async function setExpression(character, expression, force) {
if (extension_settings.expressions.live2d == false) {
if (!extension_settings.expressions.live2d) {
console.debug('entered setExpressions');
await validateImages(character);
const img = $('img.expression');
@ -961,10 +956,11 @@ async function setExpression(character, expression, force) {
setDefault();
}
});
} else {
if (extension_settings.expressions.showDefault) {
setDefault();
}
}
}
else {
if (extension_settings.expressions.showDefault) {
setDefault();
}
}
@ -982,14 +978,14 @@ async function setExpression(character, expression, force) {
live2dcheck().then(result => {
if (result) {
// Find the <img> element with id="expression-image" and class="expression"
const imgElement = document.querySelector('img#expression-image.expression');
//console.log("searching");
if (imgElement) {
//console.log("setting value");
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
}
// Find the <img> element with id="expression-image" and class="expression"
const imgElement = document.querySelector('img#expression-image.expression');
//console.log("searching");
if (imgElement) {
//console.log("setting value");
imgElement.src = getApiUrl() + '/api/live2d/result_feed';
}
} else {
//console.log("The fetch failed!");
}
@ -1254,14 +1250,15 @@ function setExpressionOverrideHtml(forceClear = false) {
</div>
<div class="inline-drawer-content">
<!-- Toggle button for aituber/static images -->
<!-- Toggle button for aituber/static images -->
<div class="toggle_button">
<label class="switch">
<label class="switch">
<input id="image_type_toggle" type="checkbox">
<span class="slider round"></span>
<label for="image_type_toggle">Image Type - Live2d (extras)</label>
</div>
<div class="offline_mode">
<label for="image_type_toggle">Image Type - Live2d (extras)</label>
</label>
</div>
<div class="offline_mode">
<small>You are in offline mode. Click on the image below to set the expression.</small>
</div>
<div class="flex-container flexnowrap">

View File

@ -35,6 +35,7 @@ const kai_settings = {
const MIN_STOP_SEQUENCE_VERSION = '1.2.2';
const MIN_STREAMING_KCPPVERSION = '1.30';
const KOBOLDCPP_ORDER = [6, 0, 1, 3, 4, 2, 5];
function formatKoboldUrl(value) {
try {
@ -143,7 +144,7 @@ export async function generateKoboldWithStreaming(generate_data, signal) {
if (done) {
return;
}
}
}
}
}
@ -276,4 +277,10 @@ $(document).ready(function () {
saveSettingsDebounced();
},
});
$('#samplers_order_recommended').on('click', function () {
kai_settings.sampler_order = KOBOLDCPP_ORDER;
sortItemsByOrder(kai_settings.sampler_order);
saveSettingsDebounced();
});
});

View File

@ -707,7 +707,7 @@ function calculateOpenRouterCost() {
const promptTokens = (oai_settings.openai_max_context - completionTokens);
const totalCost = (completionCost * completionTokens) + (promptCost * promptTokens);
if (!isNaN(totalCost)) {
cost = totalCost.toFixed(2);
cost = '$' + totalCost.toFixed(3);
}
}

View File

@ -192,6 +192,7 @@ let power_user = {
custom_stopping_strings: '',
custom_stopping_strings_macro: true,
fuzzy_search: false,
encode_tags: false,
};
let themes = [];
@ -686,6 +687,7 @@ function loadPowerUserSettings(settings, data) {
$("#custom_stopping_strings_macro").prop("checked", power_user.custom_stopping_strings_macro);
$('#fuzzy_search_checkbox').prop("checked", power_user.fuzzy_search);
$('#persona_show_notifications').prop("checked", power_user.persona_show_notifications);
$('#encode_tags').prop("checked", power_user.encode_tags);
$("#console_log_prompts").prop("checked", power_user.console_log_prompts);
$('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown);
@ -2032,6 +2034,12 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$('#encode_tags').on('input', async function () {
power_user.encode_tags = !!$(this).prop('checked');
await reloadCurrentChat();
saveSettingsDebounced();
});
$(window).on('focus', function () {
browser_has_focus = true;
});

View File

@ -188,6 +188,18 @@ table.responsiveTable {
text-align: center;
}
.mes_text table {
border-spacing: 0;
border-collapse: collapse;
}
.mes_text td,
.mes_text th {
border: 1px solid;
border-collapse: collapse;
padding: 0.25em;
}
.mes_text p {
margin-top: 0;
margin-bottom: 10px;
@ -222,6 +234,10 @@ table.responsiveTable {
font-weight: 500;
}
.mes_text rp {
display: block;
}
.mes_text blockquote {
border-left: 3px solid var(--SmartThemeQuoteColor);
padding-left: 10px;
@ -2160,6 +2176,9 @@ grammarly-extension {
transition: background-color 200ms ease-in-out;
position: relative;
user-select: none;
display: flex;
align-items: center;
justify-content: space-between;
}
#kobold_order>div:hover {
@ -2772,7 +2791,6 @@ input[type="range"]::-webkit-slider-thumb {
#power-user-option-checkboxes {
display: flex;
flex-direction: column;
row-gap: 5px;
flex-grow: 1;
}