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

This commit is contained in:
Cohee 2023-08-08 17:11:48 +03:00
commit 508e1a06da
9 changed files with 59 additions and 23 deletions

View File

@ -2549,6 +2549,9 @@
<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" />
<span data-i18n="Relaxed API URLS">Relaxed API URLS</span>
</label>
<div class="inline-drawer wide100p flexFlowColumn">
<div class="inline-drawer-toggle inline-drawer-header">

View File

@ -364,10 +364,10 @@ const system_messages = {
mes:
`Hello there! Please select the help topic you would like to learn more about:
<ul>
<li><a href="javascript:displayHelp('1')">Slash Commands</a> (or <tt>/help slash</tt>)</li>
<li><a href="javascript:displayHelp('2')">Formatting</a> (or <tt>/help format</tt>)</li>
<li><a href="javascript:displayHelp('3')">Hotkeys</a> (or <tt>/help hotkeys</tt>)</li>
<li><a href="javascript:displayHelp('4')">{{Macros}}</a> (or <tt>/help macros</tt>)</li>
<li><a href="#" data-displayHelp="1">Slash Commands</a> (or <tt>/help slash</tt>)</li>
<li><a href="#" data-displayHelp="2">Formatting</a> (or <tt>/help format</tt>)</li>
<li><a href="#" data-displayHelp="3">Hotkeys</a> (or <tt>/help hotkeys</tt>)</li>
<li><a href="#" data-displayHelp="4">{{Macros}}</a> (or <tt>/help macros</tt>)</li>
</ul>
<br><b>Still got questions left? The <a target="_blank" href="https://docs.sillytavern.app/">Official SillyTavern Documentation Website</a> has much more information!</b>`
},
@ -409,12 +409,25 @@ const system_messages = {
mes:
`Text formatting commands:
<ul>
<li><tt>{{text}}</tt> - sets a one-time behavioral bias for the AI. Resets when you send the next message.</li>
<li><tt>*text*</tt> - displays as <i>italics</i></li>
<li><tt>**text**</tt> - displays as <b>bold</b></li>
<li><tt>***text***</tt> - displays as <b><i>bold italics</i></b></li>
<li><tt>` + "```" + `text` + "```" + `</tt> - displays as a code block</li>
<li><tt>` + "`" + `text` + "`" + `</tt> - displays as inline code</li>
<li><tt>` + "```" + `text` + "```" + `</tt> - displays as a code block (new lines allowed between the backticks)</li>
<pre>
<code>
like
this
</code>
</pre>
<li><tt>` + "`" + `text` + "`" + `</tt> - displays as <code>inline code</code></li>
<li><tt>` + "> " + `text` + `</tt> - displays as a blockquote (note the space after >)</li>
<blockquote>like this</blockquote>
<li><tt>` + "# " + `text` + `</tt> - displays as a large header (note the space)</li>
<h1>like this</h1>
<li><tt>` + "## " + `text` + `</tt> - displays as a medium header (note the space)</li>
<h2>like this</h2>
<li><tt>` + "### " + `text` + `</tt> - displays as a small header (note the space)</li>
<h3>like this</h3>
<li><tt>$$ text $$</tt> - renders a LaTeX formula (if enabled)</li>
<li><tt>$ text $</tt> - renders an AsciiMath formula (if enabled)</li>
</ul>`
@ -4290,7 +4303,7 @@ async function read_avatar_load(input) {
}
export function getCropPopup(src) {
return `<h3>Set the crop position of the avatar image and click Ok to confirm.</h3>
return `<h3>Set the crop position of the avatar image and click Accept to confirm.</h3>
<div id='avatarCropWrap'>
<img id='avatarToCrop' src='${src}'>
</div>`;

View File

@ -102,8 +102,8 @@ async function generateTasks() {
}
updateUiTaskList();
setCurrentTask();
console.info(`Response for Objective: '${taskTree.description}' was \n'${taskResponse}', \nwhich created tasks \n${JSON.stringify(globalTasks.map(v => {return v.toSaveState()}), null, 2)} `)
toastr.success(`Generated ${taskTree.length} tasks`, 'Done!');
console.info(`Response for Objective: '${currentObjective.description}' was \n'${taskResponse}', \nwhich created tasks \n${JSON.stringify(currentObjective.children.map(v => {return v.toSaveState()}), null, 2)} `)
toastr.success(`Generated ${currentObjective.children.length} tasks`, 'Done!');
}
// Call Quiet Generate to check if a task is completed

View File

@ -4,6 +4,10 @@ import {
getStoppingStrings,
} from "../script.js";
import {
power_user,
} from "./power-user.js";
export {
kai_settings,
loadKoboldSettings,
@ -35,12 +39,12 @@ const MIN_STREAMING_KCPPVERSION = '1.30';
function formatKoboldUrl(value) {
try {
const url = new URL(value);
url.pathname = '/api';
if (!power_user.relaxed_api_urls) {
url.pathname = '/api';
}
return url.toString();
}
catch {
return null;
}
} catch { } // Just using URL as a validation check
return null;
}
function loadKoboldSettings(preset) {

View File

@ -164,6 +164,7 @@ let power_user = {
prefer_character_jailbreak: true,
continue_on_send: false,
trim_spaces: true,
relaxed_api_urls: false,
instruct: {
enabled: false,
@ -674,6 +675,7 @@ function loadPowerUserSettings(settings, data) {
power_user.chat_width = 50;
}
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
$('#trim_spaces').prop("checked", power_user.trim_spaces);
$('#continue_on_send').prop("checked", power_user.continue_on_send);
$('#auto_swipe').prop("checked", power_user.auto_swipe);
@ -1989,6 +1991,12 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#relaxed_api_urls").on("input", function () {
const value = !!$(this).prop('checked');
power_user.relaxed_api_urls = value;
saveSettingsDebounced();
});
$('#spoiler_free_mode').on('input', function () {
power_user.spoiler_free_mode = !!$(this).prop('checked');
switchSpoilerMode();

View File

@ -423,7 +423,11 @@ function helpCommandCallback(_, type) {
}
}
window['displayHelp'] = (page) => helpCommandCallback(null, page);
$(document).on('click', '[data-displayHelp]', function (e) {
e.preventDefault();
const page = String($(this).data('displayhelp'));
helpCommandCallback(null, page);
});
function setBackgroundCallback(_, bg) {
if (!bg) {

View File

@ -6,6 +6,10 @@ import {
setGenerationParamsFromPreset,
} from "../script.js";
import {
power_user,
} from "./power-user.js";
export {
textgenerationwebui_settings,
loadTextGenSettings,
@ -98,10 +102,11 @@ function selectPreset(name) {
function formatTextGenURL(value) {
try {
const url = new URL(value);
if (url.pathname.endsWith('/api')) {
return url.toString();
if (!power_user.relaxed_api_urls) {
url.pathname = '/api';
}
} catch { } // Try and Catch both fall through to the same return.
return url.toString();
} catch { } // Just using URL as a validation check
return null;
}

View File

@ -1511,7 +1511,7 @@ jQuery(() => {
});
$('#world_info_overflow_alert').on('change', function () {
world_info_overflow_alert = $(this).val();
world_info_overflow_alert = !!$(this).prop('checked');
saveSettingsDebounced();
});

View File

@ -217,8 +217,7 @@ table.responsiveTable {
font-weight: 500;
}
.mes_text q,
.mes_text blockquote {
.mes_text q {
color: var(--SmartThemeQuoteColor);
font-weight: 500;
}
@ -5470,4 +5469,4 @@ body.waifuMode .zoomed_avatar {
background-color: var(--SmartThemeBlurTintColor);
text-align: center;
line-height: 14px;
}
}