mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into talkinghead-talkinganim
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
characters,
|
||||
getRequestHeaders,
|
||||
} from '../../../script.js';
|
||||
import { selected_group } from '../../group-chats.js';
|
||||
import { groups, selected_group } from '../../group-chats.js';
|
||||
import { loadFileToDocument, delay } from '../../utils.js';
|
||||
import { loadMovingUIState } from '../../power-user.js';
|
||||
import { dragElement } from '../../RossAscends-mods.js';
|
||||
@@ -416,7 +416,26 @@ function viewWithDragbox(items) {
|
||||
|
||||
// Registers a simple command for opening the char gallery.
|
||||
registerSlashCommand('show-gallery', showGalleryCommand, ['sg'], '– shows the gallery', true, true);
|
||||
registerSlashCommand('list-gallery', listGalleryCommand, ['lg'], '<span class="monospace">[optional char=charName] [optional group=groupName]</span> – list images in the gallery of the current char / group or a specified char / group', true, true);
|
||||
|
||||
function showGalleryCommand(args) {
|
||||
showCharGallery();
|
||||
}
|
||||
|
||||
async function listGalleryCommand(args) {
|
||||
try {
|
||||
let url = args.char ?? (args.group ? groups.find(it=>it.name == args.group)?.id : null) ?? (selected_group || this_chid);
|
||||
if (!args.char && !args.group && !selected_group && this_chid) {
|
||||
const char = characters[this_chid];
|
||||
url = char.avatar.replace('.png', '');
|
||||
}
|
||||
|
||||
const items = await getGalleryItems(url);
|
||||
return JSON.stringify(items.map(it=>it.src));
|
||||
|
||||
} catch (err) {
|
||||
console.trace();
|
||||
console.error(err);
|
||||
}
|
||||
return JSON.stringify([]);
|
||||
}
|
||||
|
@@ -608,7 +608,8 @@ async function CreateZenSliders(elmnt) {
|
||||
sliderID == 'rep_pen_range') {
|
||||
decimals = 0;
|
||||
}
|
||||
if (sliderID == 'dynatemp_range_textgenerationwebui') {
|
||||
if (sliderID == 'min_temp_textgenerationwebui' ||
|
||||
sliderID == 'max_temp_textgenerationwebui') {
|
||||
decimals = 2;
|
||||
}
|
||||
if (sliderID == 'eta_cutoff_textgenerationwebui' ||
|
||||
@@ -635,13 +636,14 @@ async function CreateZenSliders(elmnt) {
|
||||
sliderID == 'tfs_textgenerationwebui' ||
|
||||
sliderID == 'min_p_textgenerationwebui' ||
|
||||
sliderID == 'temp_textgenerationwebui' ||
|
||||
sliderID == 'temp' ||
|
||||
sliderID == 'dynatemp_range_textgenerationwebui') {
|
||||
sliderID == 'temp') {
|
||||
numSteps = 20;
|
||||
}
|
||||
if (sliderID == 'mirostat_eta_textgenerationwebui' ||
|
||||
sliderID == 'penalty_alpha_textgenerationwebui' ||
|
||||
sliderID == 'length_penalty_textgenerationwebui') {
|
||||
sliderID == 'length_penalty_textgenerationwebui' ||
|
||||
sliderID == 'min_temp_textgenerationwebui' ||
|
||||
sliderID == 'max_temp_textgenerationwebui') {
|
||||
numSteps = 50;
|
||||
}
|
||||
//customize off values
|
||||
|
@@ -79,7 +79,9 @@ const settings = {
|
||||
presence_pen: 0,
|
||||
do_sample: true,
|
||||
early_stopping: false,
|
||||
dynatemp_range: 0,
|
||||
dynatemp: false,
|
||||
min_temp: 0,
|
||||
max_temp: 2.0,
|
||||
seed: -1,
|
||||
preset: 'Default',
|
||||
add_bos_token: true,
|
||||
@@ -138,7 +140,9 @@ const setting_names = [
|
||||
'num_beams',
|
||||
'length_penalty',
|
||||
'min_length',
|
||||
'dynatemp_range',
|
||||
'dynatemp',
|
||||
'min_temp',
|
||||
'max_temp',
|
||||
'encoder_rep_pen',
|
||||
'freq_pen',
|
||||
'presence_pen',
|
||||
@@ -706,7 +710,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
|
||||
'model': getModel(),
|
||||
'max_new_tokens': maxTokens,
|
||||
'max_tokens': maxTokens,
|
||||
'temperature': settings.temp,
|
||||
'temperature': settings.dynatemp ? (settings.min_temp + settings.max_temp) / 2 : settings.temp,
|
||||
'top_p': settings.top_p,
|
||||
'typical_p': settings.typical_p,
|
||||
'min_p': settings.min_p,
|
||||
@@ -720,7 +724,10 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
|
||||
'length_penalty': settings.length_penalty,
|
||||
'early_stopping': settings.early_stopping,
|
||||
'add_bos_token': settings.add_bos_token,
|
||||
'dynatemp_range': settings.dynatemp_range,
|
||||
'dynamic_temperature': settings.dynatemp,
|
||||
'dynatemp_low': settings.min_temp,
|
||||
'dynatemp_high': settings.max_temp,
|
||||
'dynatemp_range': settings.dynatemp ? (settings.max_temp - settings.min_temp) / 2 : 0,
|
||||
'stopping_strings': getStoppingStrings(isImpersonate, isContinue),
|
||||
'stop': getStoppingStrings(isImpersonate, isContinue),
|
||||
'truncation_length': max_context,
|
||||
|
@@ -360,6 +360,8 @@ function registerWorldInfoSlashCommands() {
|
||||
return '';
|
||||
}
|
||||
|
||||
value = value.replace(/\\([{}|])/g, '$1');
|
||||
|
||||
const data = await loadWorldInfoData(file);
|
||||
|
||||
if (!data || !('entries' in data)) {
|
||||
@@ -556,6 +558,7 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
|
||||
$('#world_popup_name_button').off('click').on('click', nullWorldInfo);
|
||||
$('#world_popup_export').off('click').on('click', nullWorldInfo);
|
||||
$('#world_popup_delete').off('click').on('click', nullWorldInfo);
|
||||
$('#world_duplicate').off('click').on('click', nullWorldInfo);
|
||||
$('#world_popup_entries_list').hide();
|
||||
$('#world_info_pagination').html('');
|
||||
return;
|
||||
@@ -693,6 +696,23 @@ function displayWorldEntries(name, data, navigation = navigation_option.none) {
|
||||
}
|
||||
});
|
||||
|
||||
$('#world_duplicate').off('click').on('click', async () => {
|
||||
const tempName = getFreeWorldName();
|
||||
const finalName = await callPopup('<h3>Create a new World Info?</h3>Enter a name for the new file:', 'input', tempName);
|
||||
|
||||
if (finalName) {
|
||||
await saveWorldInfo(finalName, data, true);
|
||||
await updateWorldInfoList();
|
||||
|
||||
const selectedIndex = world_names.indexOf(finalName);
|
||||
if (selectedIndex !== -1) {
|
||||
$('#world_editor_select').val(selectedIndex).trigger('change');
|
||||
} else {
|
||||
hideWorldEditor();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#world_popup_delete').off('click').on('click', async () => {
|
||||
const confirmation = await callPopup(`<h3>Delete the World/Lorebook: "${name}"?</h3>This action is irreversible!`, 'confirm');
|
||||
|
||||
@@ -1896,6 +1916,11 @@ async function checkWorldInfo(chat, maxContext) {
|
||||
needsToScan = false;
|
||||
}
|
||||
|
||||
if (newEntries.length === 0) {
|
||||
console.debug('No new entries activated, stopping');
|
||||
needsToScan = false;
|
||||
}
|
||||
|
||||
if (needsToScan) {
|
||||
const text = newEntries
|
||||
.filter(x => !failedProbabilityChecks.has(x))
|
||||
@@ -1997,13 +2022,17 @@ function filterByInclusionGroups(newEntries, allActivatedEntries) {
|
||||
for (const [key, group] of Object.entries(grouped)) {
|
||||
console.debug(`Checking inclusion group '${key}' with ${group.length} entries`, group);
|
||||
|
||||
if (!Array.isArray(group) || group.length <= 1) {
|
||||
console.debug('Skipping inclusion group check, only one entry');
|
||||
if (Array.from(allActivatedEntries).some(x => x.group === key)) {
|
||||
console.debug(`Skipping inclusion group check, group already activated '${key}'`);
|
||||
// We need to forcefully deactivate all other entries in the group
|
||||
for (const entry of group) {
|
||||
newEntries.splice(newEntries.indexOf(entry), 1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Array.from(allActivatedEntries).some(x => x.group === key)) {
|
||||
console.debug(`Skipping inclusion group check, group already activated '${key}'`);
|
||||
if (!Array.isArray(group) || group.length <= 1) {
|
||||
console.debug('Skipping inclusion group check, only one entry');
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user