mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into cli-args-refactor
This commit is contained in:
@@ -1294,8 +1294,8 @@
|
|||||||
<span data-i18n="TFS">TFS</span>
|
<span data-i18n="TFS">TFS</span>
|
||||||
<div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Tail_Free_Sampling_desc" title="Tail-Free Sampling (TFS) searches for a tail of low-probability tokens in the distribution, by analyzing the rate of change in token probabilities using derivatives. It retains tokens up to a threshold (e.g., 0.3) based on the normalized second derivative. The closer to 0, the more discarded tokens. Set to 1.0 to disable."></div>
|
<div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Tail_Free_Sampling_desc" title="Tail-Free Sampling (TFS) searches for a tail of low-probability tokens in the distribution, by analyzing the rate of change in token probabilities using derivatives. It retains tokens up to a threshold (e.g., 0.3) based on the normalized second derivative. The closer to 0, the more discarded tokens. Set to 1.0 to disable."></div>
|
||||||
</small>
|
</small>
|
||||||
<input class="neo-range-slider" type="range" id="tfs_textgenerationwebui" name="volume" min="0" max="1" step="0.01">
|
<input class="neo-range-slider" type="range" id="tfs_textgenerationwebui" name="volume" min="0" max="1" step="0.001">
|
||||||
<input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="tfs_textgenerationwebui" id="tfs_counter_textgenerationwebui">
|
<input class="neo-range-input" type="number" min="0" max="1" step="0.001" data-for="tfs_textgenerationwebui" id="tfs_counter_textgenerationwebui">
|
||||||
</div>
|
</div>
|
||||||
<div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
|
<div data-tg-type="ooba,mancer,aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis30p flexGrow flexShrink gap0">
|
||||||
<small>
|
<small>
|
||||||
@@ -1477,8 +1477,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
<div class="alignitemscenter flex-container marginBot5 flexFlowColumn flexGrow flexShrink gap0">
|
||||||
<small data-i18n="Exponent">Exponent</small>
|
<small data-i18n="Exponent">Exponent</small>
|
||||||
<input class="neo-range-slider" type="range" id="dynatemp_exponent_textgenerationwebui" name="volume" min="0.01" max="10" step="0.01" />
|
<input class="neo-range-slider" type="range" id="dynatemp_exponent_textgenerationwebui" name="volume" min="0.001" max="10" step="0.001" />
|
||||||
<input class="neo-range-input" type="number" min="0.01" max="10" step="0.01" data-for="dynatemp_exponent_textgenerationwebui" id="dynatemp_exponent_counter_textgenerationwebui">
|
<input class="neo-range-input" type="number" min="0.001" max="10" step="0.001" data-for="dynatemp_exponent_textgenerationwebui" id="dynatemp_exponent_counter_textgenerationwebui">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -606,7 +606,6 @@ export const printCharactersDebounced = debounce(() => { printCharacters(false);
|
|||||||
export const system_message_types = {
|
export const system_message_types = {
|
||||||
HELP: 'help',
|
HELP: 'help',
|
||||||
WELCOME: 'welcome',
|
WELCOME: 'welcome',
|
||||||
GROUP: 'group',
|
|
||||||
EMPTY: 'empty',
|
EMPTY: 'empty',
|
||||||
GENERIC: 'generic',
|
GENERIC: 'generic',
|
||||||
NARRATOR: 'narrator',
|
NARRATOR: 'narrator',
|
||||||
@@ -699,14 +698,6 @@ async function getSystemMessages() {
|
|||||||
uses_system_ui: true,
|
uses_system_ui: true,
|
||||||
mes: await renderTemplateAsync('welcome', { displayVersion }),
|
mes: await renderTemplateAsync('welcome', { displayVersion }),
|
||||||
},
|
},
|
||||||
group: {
|
|
||||||
name: systemUserName,
|
|
||||||
force_avatar: system_avatar,
|
|
||||||
is_user: false,
|
|
||||||
is_system: true,
|
|
||||||
is_group: true,
|
|
||||||
mes: 'Group chat created. Say \'Hi\' to lovely people!',
|
|
||||||
},
|
|
||||||
empty: {
|
empty: {
|
||||||
name: systemUserName,
|
name: systemUserName,
|
||||||
force_avatar: system_avatar,
|
force_avatar: system_avatar,
|
||||||
|
@@ -318,16 +318,6 @@ export async function convertSoloToGroupChat() {
|
|||||||
const groupChat = chat.slice();
|
const groupChat = chat.slice();
|
||||||
const genIdFirst = Date.now();
|
const genIdFirst = Date.now();
|
||||||
|
|
||||||
// Add something if the chat is empty
|
|
||||||
if (groupChat.length === 0) {
|
|
||||||
const newMessage = {
|
|
||||||
...system_messages[system_message_types.GROUP],
|
|
||||||
send_date: getMessageTimeStamp(),
|
|
||||||
extra: { type: system_message_types.GROUP },
|
|
||||||
};
|
|
||||||
groupChat.push(newMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let index = 0; index < groupChat.length; index++) {
|
for (let index = 0; index < groupChat.length; index++) {
|
||||||
const message = groupChat[index];
|
const message = groupChat[index];
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ import { renderTemplate, renderTemplateAsync } from './templates.js';
|
|||||||
import { delay, isSubsetOf, sanitizeSelector, setValueByPath } from './utils.js';
|
import { delay, isSubsetOf, sanitizeSelector, setValueByPath } from './utils.js';
|
||||||
import { getContext } from './st-context.js';
|
import { getContext } from './st-context.js';
|
||||||
import { isAdmin } from './user.js';
|
import { isAdmin } from './user.js';
|
||||||
import { t } from './i18n.js';
|
import { addLocaleData, getCurrentLocale, t } from './i18n.js';
|
||||||
import { debounce_timeout } from './constants.js';
|
import { debounce_timeout } from './constants.js';
|
||||||
import { accountStorage } from './util/AccountStorage.js';
|
import { accountStorage } from './util/AccountStorage.js';
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ async function activateExtensions() {
|
|||||||
if (meetsModuleRequirements && !isDisabled) {
|
if (meetsModuleRequirements && !isDisabled) {
|
||||||
try {
|
try {
|
||||||
console.debug('Activating extension', name);
|
console.debug('Activating extension', name);
|
||||||
const promise = Promise.all([addExtensionScript(name, manifest), addExtensionStyle(name, manifest)]);
|
const promise = addExtensionLocale(name, manifest).finally(() => Promise.all([addExtensionScript(name, manifest), addExtensionStyle(name, manifest)]));
|
||||||
await promise
|
await promise
|
||||||
.then(() => activeExtensions.add(name))
|
.then(() => activeExtensions.add(name))
|
||||||
.catch(err => console.log('Could not activate extension', name, err));
|
.catch(err => console.log('Could not activate extension', name, err));
|
||||||
@@ -576,6 +576,42 @@ function addExtensionScript(name, manifest) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a localization data for an extension.
|
||||||
|
* @param {string} name Extension name
|
||||||
|
* @param {object} manifest Manifest object
|
||||||
|
*/
|
||||||
|
function addExtensionLocale(name, manifest) {
|
||||||
|
// No i18n data in the manifest
|
||||||
|
if (!manifest.i18n || typeof manifest.i18n !== 'object') {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentLocale = getCurrentLocale();
|
||||||
|
const localeFile = manifest.i18n[currentLocale];
|
||||||
|
|
||||||
|
// Manifest doesn't provide a locale file for the current locale
|
||||||
|
if (!localeFile) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(`/scripts/extensions/${name}/${localeFile}`)
|
||||||
|
.then(async response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (data && typeof data === 'object') {
|
||||||
|
addLocaleData(currentLocale, data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log('Could not load extension locale data for ' + name, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates HTML string for displaying an extension in the UI.
|
* Generates HTML string for displaying an extension in the UI.
|
||||||
*
|
*
|
||||||
|
@@ -228,9 +228,6 @@ export async function getGroupChat(groupId, reload = false) {
|
|||||||
chat.splice(0, chat.length, ...data);
|
chat.splice(0, chat.length, ...data);
|
||||||
await printMessages();
|
await printMessages();
|
||||||
} else {
|
} else {
|
||||||
sendSystemMessage(system_message_types.GROUP, '', { isSmallSys: true });
|
|
||||||
await eventSource.emit(event_types.MESSAGE_RECEIVED, (chat.length - 1));
|
|
||||||
await eventSource.emit(event_types.CHARACTER_MESSAGE_RENDERED, (chat.length - 1));
|
|
||||||
if (group && Array.isArray(group.members)) {
|
if (group && Array.isArray(group.members)) {
|
||||||
for (let member of group.members) {
|
for (let member of group.members) {
|
||||||
const character = characters.find(x => x.avatar === member || x.name === member);
|
const character = characters.find(x => x.avatar === member || x.name === member);
|
||||||
|
@@ -11,6 +11,30 @@ var localeData;
|
|||||||
|
|
||||||
export const getCurrentLocale = () => localeFile;
|
export const getCurrentLocale = () => localeFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds additional localization data to the current locale file.
|
||||||
|
* @param {string} localeId Locale ID (e.g. 'fr-fr' or 'zh-cn')
|
||||||
|
* @param {Record<string, string>} data Localization data to add
|
||||||
|
*/
|
||||||
|
export function addLocaleData(localeId, data) {
|
||||||
|
if (!localeData) {
|
||||||
|
console.warn('Localization data not loaded yet. Additional data will not be added.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (localeId !== localeFile) {
|
||||||
|
console.debug('Ignoring addLocaleData call for different locale', localeId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(data)) {
|
||||||
|
// Overrides for default locale data are not allowed
|
||||||
|
if (!Object.hasOwn(localeData, key)) {
|
||||||
|
localeData[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An observer that will check if any new i18n elements are added to the document
|
* An observer that will check if any new i18n elements are added to the document
|
||||||
* @type {MutationObserver}
|
* @type {MutationObserver}
|
||||||
|
@@ -644,7 +644,6 @@ async function CreateZenSliders(elmnt) {
|
|||||||
}
|
}
|
||||||
if (sliderID == 'min_temp_textgenerationwebui' ||
|
if (sliderID == 'min_temp_textgenerationwebui' ||
|
||||||
sliderID == 'max_temp_textgenerationwebui' ||
|
sliderID == 'max_temp_textgenerationwebui' ||
|
||||||
sliderID == 'dynatemp_exponent_textgenerationwebui' ||
|
|
||||||
sliderID == 'smoothing_curve_textgenerationwebui' ||
|
sliderID == 'smoothing_curve_textgenerationwebui' ||
|
||||||
sliderID == 'smoothing_factor_textgenerationwebui' ||
|
sliderID == 'smoothing_factor_textgenerationwebui' ||
|
||||||
sliderID == 'dry_multiplier_textgenerationwebui' ||
|
sliderID == 'dry_multiplier_textgenerationwebui' ||
|
||||||
|
@@ -54,7 +54,7 @@ import {
|
|||||||
writeExtensionField,
|
writeExtensionField,
|
||||||
} from './extensions.js';
|
} from './extensions.js';
|
||||||
import { groups, openGroupChat, selected_group } from './group-chats.js';
|
import { groups, openGroupChat, selected_group } from './group-chats.js';
|
||||||
import { t, translate } from './i18n.js';
|
import { addLocaleData, getCurrentLocale, t, translate } from './i18n.js';
|
||||||
import { hideLoader, showLoader } from './loader.js';
|
import { hideLoader, showLoader } from './loader.js';
|
||||||
import { MacrosParser } from './macros.js';
|
import { MacrosParser } from './macros.js';
|
||||||
import { getChatCompletionModel, oai_settings } from './openai.js';
|
import { getChatCompletionModel, oai_settings } from './openai.js';
|
||||||
@@ -165,6 +165,8 @@ export function getContext() {
|
|||||||
isMobile,
|
isMobile,
|
||||||
t,
|
t,
|
||||||
translate,
|
translate,
|
||||||
|
getCurrentLocale,
|
||||||
|
addLocaleData,
|
||||||
tags,
|
tags,
|
||||||
tagMap: tag_map,
|
tagMap: tag_map,
|
||||||
menuType: menu_type,
|
menuType: menu_type,
|
||||||
|
@@ -323,7 +323,7 @@ router.get('/discover', jsonParser, function (request, response) {
|
|||||||
|
|
||||||
// Combine all extensions
|
// Combine all extensions
|
||||||
const allExtensions = [...builtInExtensions, ...userExtensions, ...globalExtensions];
|
const allExtensions = [...builtInExtensions, ...userExtensions, ...globalExtensions];
|
||||||
console.info('Extensions available for', request.user.profile.handle, allExtensions);
|
console.debug('Extensions available for', request.user.profile.handle, allExtensions);
|
||||||
|
|
||||||
return response.send(allExtensions);
|
return response.send(allExtensions);
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user