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
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" /> <label for="spoiler_free_mode"><input id="spoiler_free_mode" type="checkbox" />
<span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span> <span data-i18n="Spoiler Free Mode">Spoiler Free Mode</span>
</label> </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 wide100p flexFlowColumn">
<div class="inline-drawer-toggle inline-drawer-header"> <div class="inline-drawer-toggle inline-drawer-header">

View File

@ -364,10 +364,10 @@ const system_messages = {
mes: mes:
`Hello there! Please select the help topic you would like to learn more about: `Hello there! Please select the help topic you would like to learn more about:
<ul> <ul>
<li><a href="javascript:displayHelp('1')">Slash Commands</a> (or <tt>/help slash</tt>)</li> <li><a href="#" data-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="#" data-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="#" data-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="4">{{Macros}}</a> (or <tt>/help macros</tt>)</li>
</ul> </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>` <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: mes:
`Text formatting commands: `Text formatting commands:
<ul> <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 <i>italics</i></li>
<li><tt>**text**</tt> - displays as <b>bold</b></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 <b><i>bold italics</i></b></li>
<li><tt>` + "```" + `text` + "```" + `</tt> - displays as a code block</li> <li><tt>` + "```" + `text` + "```" + `</tt> - displays as a code block (new lines allowed between the backticks)</li>
<li><tt>` + "`" + `text` + "`" + `</tt> - displays as inline code</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 a LaTeX formula (if enabled)</li>
<li><tt>$ text $</tt> - renders an AsciiMath formula (if enabled)</li> <li><tt>$ text $</tt> - renders an AsciiMath formula (if enabled)</li>
</ul>` </ul>`
@ -4290,7 +4303,7 @@ async function read_avatar_load(input) {
} }
export function getCropPopup(src) { 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'> <div id='avatarCropWrap'>
<img id='avatarToCrop' src='${src}'> <img id='avatarToCrop' src='${src}'>
</div>`; </div>`;

View File

@ -102,8 +102,8 @@ async function generateTasks() {
} }
updateUiTaskList(); updateUiTaskList();
setCurrentTask(); 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)} `) 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 ${taskTree.length} tasks`, 'Done!'); toastr.success(`Generated ${currentObjective.children.length} tasks`, 'Done!');
} }
// Call Quiet Generate to check if a task is completed // Call Quiet Generate to check if a task is completed

View File

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

View File

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

View File

@ -6,6 +6,10 @@ import {
setGenerationParamsFromPreset, setGenerationParamsFromPreset,
} from "../script.js"; } from "../script.js";
import {
power_user,
} from "./power-user.js";
export { export {
textgenerationwebui_settings, textgenerationwebui_settings,
loadTextGenSettings, loadTextGenSettings,
@ -98,10 +102,11 @@ function selectPreset(name) {
function formatTextGenURL(value) { function formatTextGenURL(value) {
try { try {
const url = new URL(value); const url = new URL(value);
if (url.pathname.endsWith('/api')) { if (!power_user.relaxed_api_urls) {
return url.toString(); 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; return null;
} }

View File

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

View File

@ -217,8 +217,7 @@ table.responsiveTable {
font-weight: 500; font-weight: 500;
} }
.mes_text q, .mes_text q {
.mes_text blockquote {
color: var(--SmartThemeQuoteColor); color: var(--SmartThemeQuoteColor);
font-weight: 500; font-weight: 500;
} }