mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@@ -8566,7 +8566,7 @@ export function showSwipeButtons() {
|
|||||||
|
|
||||||
//had to add this to make the swipe counter work
|
//had to add this to make the swipe counter work
|
||||||
//(copied from the onclick functions for swipe buttons..
|
//(copied from the onclick functions for swipe buttons..
|
||||||
//don't know why the array isn't set for non-swipe messsages in Generate or addOneMessage..)
|
//don't know why the array isn't set for non-swipe messages in Generate or addOneMessage..)
|
||||||
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
if (chat[chat.length - 1]['swipe_id'] === undefined) { // if there is no swipe-message in the last spot of the chat array
|
||||||
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
chat[chat.length - 1]['swipe_id'] = 0; // set it to id 0
|
||||||
chat[chat.length - 1]['swipes'] = []; // empty the array
|
chat[chat.length - 1]['swipes'] = []; // empty the array
|
||||||
|
@@ -279,9 +279,9 @@ export class TextCompletionService {
|
|||||||
instructPreset,
|
instructPreset,
|
||||||
);
|
);
|
||||||
} else { // e.g. "<|im_start|>assistant: Hello, my name is"
|
} else { // e.g. "<|im_start|>assistant: Hello, my name is"
|
||||||
const overridenInstructPreset = structuredClone(instructPreset);
|
const overriddenInstructPreset = structuredClone(instructPreset);
|
||||||
overridenInstructPreset.output_suffix = '';
|
overriddenInstructPreset.output_suffix = '';
|
||||||
overridenInstructPreset.wrap = false;
|
overriddenInstructPreset.wrap = false;
|
||||||
messageContent = formatInstructModeChat(
|
messageContent = formatInstructModeChat(
|
||||||
message.role,
|
message.role,
|
||||||
message.content,
|
message.content,
|
||||||
@@ -291,7 +291,7 @@ export class TextCompletionService {
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
overridenInstructPreset,
|
overriddenInstructPreset,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -584,7 +584,7 @@ export function getNovelGenerationData(finalPrompt, settings, maxLength, isImper
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the prefix needs to be overriden to use instruct mode
|
// Check if the prefix needs to be overridden to use instruct mode
|
||||||
function selectPrefix(selected_prefix, finalPrompt) {
|
function selectPrefix(selected_prefix, finalPrompt) {
|
||||||
let useInstruct = false;
|
let useInstruct = false;
|
||||||
const clio = nai_settings.model_novel.includes('clio');
|
const clio = nai_settings.model_novel.includes('clio');
|
||||||
|
@@ -132,7 +132,7 @@ function reloadUserAvatar(force = false) {
|
|||||||
/**
|
/**
|
||||||
* Sort the given personas
|
* Sort the given personas
|
||||||
* @param {string[]} personas - The persona names to sort
|
* @param {string[]} personas - The persona names to sort
|
||||||
* @returns {string[]} The sorted persona names arrray, same reference as passed in
|
* @returns {string[]} The sorted persona names array, same reference as passed in
|
||||||
*/
|
*/
|
||||||
function sortPersonas(personas) {
|
function sortPersonas(personas) {
|
||||||
const option = $('#persona_sort_order').find(':selected');
|
const option = $('#persona_sort_order').find(':selected');
|
||||||
@@ -1821,7 +1821,7 @@ function registerPersonaSlashCommands() {
|
|||||||
defaultValue: 'chat',
|
defaultValue: 'chat',
|
||||||
enumList: [
|
enumList: [
|
||||||
new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'),
|
new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'),
|
||||||
new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, mutliple personas can be locked to the same character.'),
|
new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, multiple personas can be locked to the same character.'),
|
||||||
new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'),
|
new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
@@ -1857,7 +1857,7 @@ function registerPersonaSlashCommands() {
|
|||||||
defaultValue: 'chat',
|
defaultValue: 'chat',
|
||||||
enumList: [
|
enumList: [
|
||||||
new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'),
|
new SlashCommandEnumValue('chat', 'Lock the persona to the current chat.'),
|
||||||
new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, mutliple personas can be locked to the same character.'),
|
new SlashCommandEnumValue('character', 'Lock this persona to the currently selected character. If the setting is enabled, multiple personas can be locked to the same character.'),
|
||||||
new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'),
|
new SlashCommandEnumValue('default', 'Lock this persona as the default persona for all new chats.'),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@@ -315,7 +315,7 @@ export class Popup {
|
|||||||
if (defaultButton) defaultButton.classList.add('menu_button_default');
|
if (defaultButton) defaultButton.classList.add('menu_button_default');
|
||||||
|
|
||||||
// Styling differences depending on the popup type
|
// Styling differences depending on the popup type
|
||||||
// General styling for all types first, that might be overriden for specific types below
|
// General styling for all types first, that might be overridden for specific types below
|
||||||
this.mainInput.style.display = 'none';
|
this.mainInput.style.display = 'none';
|
||||||
this.inputControls.style.display = customInputs ? 'block' : 'none';
|
this.inputControls.style.display = customInputs ? 'block' : 'none';
|
||||||
this.closeButton.style.display = 'none';
|
this.closeButton.style.display = 'none';
|
||||||
|
@@ -426,7 +426,7 @@ export class ReasoningHandler {
|
|||||||
if (!this.#isParsingReasoning)
|
if (!this.#isParsingReasoning)
|
||||||
return mesChanged;
|
return mesChanged;
|
||||||
|
|
||||||
// If we are in manual parsing mode, all currently streaming mes tokens will go the the reasoning block
|
// If we are in manual parsing mode, all currently streaming mes tokens will go to the reasoning block
|
||||||
this.reasoning = parseTarget.slice(power_user.reasoning.prefix.length);
|
this.reasoning = parseTarget.slice(power_user.reasoning.prefix.length);
|
||||||
message.mes = '';
|
message.mes = '';
|
||||||
|
|
||||||
|
@@ -264,9 +264,9 @@ function countWords(str) {
|
|||||||
* @param {string} type - The type of the message processing (e.g., 'append', 'continue', 'appendFinal', 'swipe').
|
* @param {string} type - The type of the message processing (e.g., 'append', 'continue', 'appendFinal', 'swipe').
|
||||||
* @param {Object} characters - Object containing character data.
|
* @param {Object} characters - Object containing character data.
|
||||||
* @param {string} this_chid - The character id.
|
* @param {string} this_chid - The character id.
|
||||||
* @param {string} oldMesssage - The old message that's being processed.
|
* @param {string} oldMessage - The old message that's being processed.
|
||||||
*/
|
*/
|
||||||
async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
async function statMesProcess(line, type, characters, this_chid, oldMessage) {
|
||||||
if (this_chid === undefined || characters[this_chid] === undefined) {
|
if (this_chid === undefined || characters[this_chid] === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
|||||||
stat.user_msg_count++;
|
stat.user_msg_count++;
|
||||||
stat.user_word_count += countWords(line.mes);
|
stat.user_word_count += countWords(line.mes);
|
||||||
} else {
|
} else {
|
||||||
let oldLen = oldMesssage.split(' ').length;
|
let oldLen = oldMessage.split(' ').length;
|
||||||
stat.user_word_count += countWords(line.mes) - oldLen;
|
stat.user_word_count += countWords(line.mes) - oldLen;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -305,7 +305,7 @@ async function statMesProcess(line, type, characters, this_chid, oldMesssage) {
|
|||||||
stat.non_user_msg_count++;
|
stat.non_user_msg_count++;
|
||||||
stat.non_user_word_count += countWords(line.mes);
|
stat.non_user_word_count += countWords(line.mes);
|
||||||
} else {
|
} else {
|
||||||
let oldLen = oldMesssage.split(' ').length;
|
let oldLen = oldMessage.split(' ').length;
|
||||||
stat.non_user_word_count += countWords(line.mes) - oldLen;
|
stat.non_user_word_count += countWords(line.mes) - oldLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -917,7 +917,7 @@ function newTag(tagName) {
|
|||||||
/**
|
/**
|
||||||
* @typedef {object} PrintTagListOptions - Optional parameters for printing the tag list.
|
* @typedef {object} PrintTagListOptions - Optional parameters for printing the tag list.
|
||||||
* @property {Tag[]|function(): Tag[]} [tags=undefined] - Optional override of tags that should be printed. Those will not be sorted. If no supplied, tags for the relevant character are printed. Can also be a function that returns the tags.
|
* @property {Tag[]|function(): Tag[]} [tags=undefined] - Optional override of tags that should be printed. Those will not be sorted. If no supplied, tags for the relevant character are printed. Can also be a function that returns the tags.
|
||||||
* @property {Tag|Tag[]} [addTag=undefined] - Optionally provide one or multiple tags that should be manually added to this print. Either to the overriden tag list or the found tags based on the entity/key. Will respect the tag exists check.
|
* @property {Tag|Tag[]} [addTag=undefined] - Optionally provide one or multiple tags that should be manually added to this print. Either to the overridden tag list or the found tags based on the entity/key. Will respect the tag exists check.
|
||||||
* @property {object|number|string} [forEntityOrKey=undefined] - Optional override for the chosen entity, otherwise the currently selected is chosen. Can be an entity with id property (character, group, tag), or directly an id or tag key.
|
* @property {object|number|string} [forEntityOrKey=undefined] - Optional override for the chosen entity, otherwise the currently selected is chosen. Can be an entity with id property (character, group, tag), or directly an id or tag key.
|
||||||
* @property {boolean|string} [empty=true] - Whether the list should be initially empty. If a string string is provided, 'always' will always empty the list, otherwise it'll evaluate to a boolean.
|
* @property {boolean|string} [empty=true] - Whether the list should be initially empty. If a string string is provided, 'always' will always empty the list, otherwise it'll evaluate to a boolean.
|
||||||
* @property {boolean} [sort=true] - Whether the tags should be sorted via the sort function, or kept as is.
|
* @property {boolean} [sort=true] - Whether the tags should be sorted via the sort function, or kept as is.
|
||||||
|
@@ -2316,7 +2316,7 @@ export function deleteWIOriginalDataValue(data, uid) {
|
|||||||
/**
|
/**
|
||||||
* Splits a given input string that contains one or more keywords or regexes, separated by commas.
|
* Splits a given input string that contains one or more keywords or regexes, separated by commas.
|
||||||
*
|
*
|
||||||
* Each part can be a valid regex following the pattern `/myregex/flags` with optional flags. Commmas inside the regex are allowed, slashes have to be escaped like this: `\/`
|
* Each part can be a valid regex following the pattern `/myregex/flags` with optional flags. Commas inside the regex are allowed, slashes have to be escaped like this: `\/`
|
||||||
* If a regex doesn't stand alone, it is not treated as a regex.
|
* If a regex doesn't stand alone, it is not treated as a regex.
|
||||||
*
|
*
|
||||||
* @param {string} input - One or multiple keywords or regexes, separated by commas
|
* @param {string} input - One or multiple keywords or regexes, separated by commas
|
||||||
|
@@ -1048,7 +1048,7 @@ router.post('/edit', validateAvatarUrlMiddleware, async function (request, respo
|
|||||||
return response.sendStatus(200);
|
return response.sendStatus(200);
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
console.error('An error occured, character edit invalidated.');
|
console.error('An error occurred, character edit invalidated.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1094,7 +1094,7 @@ router.post('/edit-attribute', validateAvatarUrlMiddleware, async function (requ
|
|||||||
await writeCharacterData(avatarPath, newCharJSON, targetFile, request);
|
await writeCharacterData(avatarPath, newCharJSON, targetFile, request);
|
||||||
return response.sendStatus(200);
|
return response.sendStatus(200);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('An error occured, character edit invalidated.', err);
|
console.error('An error occurred, character edit invalidated.', err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user