mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-09 00:28:52 +01:00
Merge branch 'staging' into parser-followup-2
This commit is contained in:
commit
7de5bd00be
@ -1292,7 +1292,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Enable for llama.cpp when the PR is merged: https://github.com/ggerganov/llama.cpp/pull/6839 -->
|
||||
<div data-newbie-hidden data-tg-type="ooba" id="dryBlock" class="wide100p">
|
||||
<div data-newbie-hidden data-tg-type="ooba, koboldcpp" id="dryBlock" class="wide100p">
|
||||
<h4 class="wide100p textAlignCenter" title="DRY penalizes tokens that would extend the end of the input into a sequence that has previously occurred in the input. Set multiplier to 0 to disable." data-i18n="[title]DRY_Repetition_Penalty_desc">
|
||||
<label data-i18n="DRY Repetition Penalty">DRY Repetition Penalty</label>
|
||||
<a href="https://github.com/oobabooga/text-generation-webui/pull/5677" target="_blank">
|
||||
@ -1315,7 +1315,7 @@
|
||||
<input class="neo-range-slider" type="range" id="dry_allowed_length_textgenerationwebui" min="1" max="20" step="1" />
|
||||
<input class="neo-range-input" type="number" min="1" max="20" step="1" data-for="dry_allowed_length_textgenerationwebui" id="dry_allowed_length_counter_textgenerationwebui">
|
||||
</div>
|
||||
<div class="alignItemsCenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-tg-type="llamacpp">
|
||||
<div class="alignItemsCenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-tg-type="llamacpp, koboldcpp">
|
||||
<small data-i18n="Penalty Range">Penalty Range</small>
|
||||
<input class="neo-range-slider" type="range" id="dry_penalty_last_n_textgenerationwebui" min="0" max="8192" step="1" />
|
||||
<input class="neo-range-input" type="number" min="0" max="8192" step="1" data-for="dry_penalty_last_n_textgenerationwebui" id="dry_penalty_last_n_counter_textgenerationwebui">
|
||||
@ -5123,23 +5123,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- templates for JS to reuse when needed -->
|
||||
<div id="scenario_override_template" class="template_element">
|
||||
<div class="scenario_override range-block flexFlowColumn flex-container">
|
||||
<div class="range-block-title title_restorable">
|
||||
<h3><span data-i18n="Chat Scenario Override" class="margin0">Chat Scenario Override</span></h3>
|
||||
<div title="Remove" data-i18n="[title]Remove" class="menu_button fa-solid fa-trash-can remove_scenario_override"></div>
|
||||
</div>
|
||||
<div class="range-block-counter justifyLeft flex-container flexFlowColumn">
|
||||
<strong>Unique to this chat.</strong>
|
||||
<span data-group="true">All group members will use the following scenario text instead of what is specified in their character cards.</span>
|
||||
<span data-character="true">The following scenario text will be used instead of the value set in the character card.</span>
|
||||
Checkpoints inherit the scenario override from their parent, and can be changed individually after that.
|
||||
</div>
|
||||
<div class="range-block-range wide100p">
|
||||
<textarea class="wide100p chat_scenario" class="text_pole" rows="15" data-i18n="[placeholder]Type here..." placeholder="Type here..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="chat_world_template" class="template_element">
|
||||
<div class="chat_world range-block flexFlowColumn flex-container">
|
||||
<div class="range-block-title">
|
||||
|
@ -7184,20 +7184,23 @@ function updateFavButtonState(state) {
|
||||
$('#favorite_button').toggleClass('fav_off', !fav_ch_checked);
|
||||
}
|
||||
|
||||
export function setScenarioOverride() {
|
||||
export async function setScenarioOverride() {
|
||||
if (!selected_group && !this_chid) {
|
||||
console.warn('setScenarioOverride() -- no selected group or character');
|
||||
return;
|
||||
}
|
||||
|
||||
const template = $('#scenario_override_template .scenario_override').clone();
|
||||
const metadataValue = chat_metadata['scenario'] || '';
|
||||
const isGroup = !!selected_group;
|
||||
template.find('[data-group="true"]').toggle(isGroup);
|
||||
template.find('[data-character="true"]').toggle(!isGroup);
|
||||
template.find('.chat_scenario').val(metadataValue).on('input', onScenarioOverrideInput);
|
||||
template.find('.remove_scenario_override').on('click', onScenarioOverrideRemoveClick);
|
||||
callPopup(template, 'text');
|
||||
|
||||
const $template = $(await renderTemplateAsync('scenarioOverride'));
|
||||
$template.find('[data-group="true"]').toggle(isGroup);
|
||||
$template.find('[data-character="true"]').toggle(!isGroup);
|
||||
// TODO: Why does this save on every character input? Save on popup close
|
||||
$template.find('.chat_scenario').val(metadataValue).on('input', onScenarioOverrideInput);
|
||||
$template.find('.remove_scenario_override').on('click', onScenarioOverrideRemoveClick);
|
||||
|
||||
await callGenericPopup($template, POPUP_TYPE.TEXT, '');
|
||||
}
|
||||
|
||||
function onScenarioOverrideInput() {
|
||||
@ -10653,7 +10656,7 @@ jQuery(async function () {
|
||||
openCharacterWorldPopup();
|
||||
break;
|
||||
case 'set_chat_scenario':
|
||||
setScenarioOverride();
|
||||
await setScenarioOverride();
|
||||
break;
|
||||
case 'renameCharButton':
|
||||
renameCharacter();
|
||||
@ -10674,7 +10677,7 @@ jQuery(async function () {
|
||||
const source = getCharacterSource(this_chid);
|
||||
if (source && isValidUrl(source)) {
|
||||
const url = new URL(source);
|
||||
const confirm = await callPopup(`Open ${url.hostname} in a new tab?`, 'confirm');
|
||||
const confirm = await Popup.show.confirm('Open Source', `<span>Do you want to open the link to ${url.hostname} in a new tab?</span><var>${url}</var>`);
|
||||
if (confirm) {
|
||||
window.open(source, '_blank');
|
||||
}
|
||||
@ -10683,7 +10686,7 @@ jQuery(async function () {
|
||||
}
|
||||
} break;
|
||||
case 'replace_update': {
|
||||
const confirm = await callPopup('<p><b>Choose a new character card to replace this character with.</b></p><p>All chats, assets and group memberships will be preserved, but local changes to the character data will be lost.</p><p>Proceed?</p>', 'confirm', '');
|
||||
const confirm = await Popup.show.confirm('Replace Character', '<p>Choose a new character card to replace this character with.</p>All chats, assets and group memberships will be preserved, but local changes to the character data will be lost.<br />Proceed?');
|
||||
if (confirm) {
|
||||
async function uploadReplacementCard(e) {
|
||||
const file = e.target.files[0];
|
||||
|
@ -395,19 +395,16 @@ export async function convertCharacterToPersona(characterId = null) {
|
||||
const overwriteName = `${name} (Persona).png`;
|
||||
|
||||
if (overwriteName in power_user.personas) {
|
||||
const confirmation = await callPopup('This character exists as a persona already. Are you sure want to overwrite it?', 'confirm', '', { okButton: 'Yes' });
|
||||
|
||||
if (confirmation === false) {
|
||||
const confirm = await Popup.show.confirm('Overwrite Existing Persona', 'This character exists as a persona already. Do you want to overwrite it?');
|
||||
if (!confirm) {
|
||||
console.log('User cancelled the overwrite of the persona');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (description.includes('{{char}}') || description.includes('{{user}}')) {
|
||||
await delay(500);
|
||||
const confirmation = await callPopup('This character has a description that uses {{char}} or {{user}} macros. Do you want to swap them in the persona description?', 'confirm', '', { okButton: 'Yes' });
|
||||
|
||||
if (confirmation) {
|
||||
const confirm = await Popup.show.confirm('Persona Description Macros', 'This character has a description that uses <code>{{char}}</code> or <code>{{user}}</code> macros. Do you want to swap them in the persona description?');
|
||||
if (confirm) {
|
||||
description = description.replace(/{{char}}/gi, '{{personaChar}}').replace(/{{user}}/gi, '{{personaUser}}');
|
||||
description = description.replace(/{{personaUser}}/gi, '{{char}}').replace(/{{personaChar}}/gi, '{{user}}');
|
||||
}
|
||||
|
17
public/scripts/templates/scenarioOverride.html
Normal file
17
public/scripts/templates/scenarioOverride.html
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="scenario_override range-block flexFlowColumn flex-container">
|
||||
<div class="range-block-title title_restorable">
|
||||
<h3><span data-i18n="Chat Scenario Override" class="margin0">Chat Scenario Override</span></h3>
|
||||
<div title="Remove" data-i18n="[title]Remove"
|
||||
class="menu_button fa-solid fa-trash-can remove_scenario_override"></div>
|
||||
</div>
|
||||
<div class="range-block-counter justifyLeft flex-container flexFlowColumn">
|
||||
<strong>Unique to this chat.</strong>
|
||||
<span data-group="true">All group members will use the following scenario text instead of what is specified in their character cards.</span>
|
||||
<span data-character="true">The following scenario text will be used instead of the value set in the character card.</span>
|
||||
Checkpoints inherit the scenario override from their parent, and can be changed individually after that.
|
||||
</div>
|
||||
<div class="range-block-range wide100p">
|
||||
<textarea class="wide100p chat_scenario" class="text_pole" rows="15" data-i18n="[placeholder]Type here..."
|
||||
placeholder="Type here..."></textarea>
|
||||
</div>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user