mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge remote-tracking branch 'upstream/staging' into quad-sample
This commit is contained in:
@@ -36,7 +36,8 @@ body.charListGrid #rm_print_characters_block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body.charListGrid #rm_print_characters_block .bogus_folder_select,
|
body.charListGrid #rm_print_characters_block .bogus_folder_select,
|
||||||
body.charListGrid #rm_print_characters_block .character_select {
|
body.charListGrid #rm_print_characters_block .character_select,
|
||||||
|
#user_avatar_block.gridView .avatar-container {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
height: min-content;
|
height: min-content;
|
||||||
@@ -47,7 +48,8 @@ body.charListGrid #rm_print_characters_block .character_select {
|
|||||||
|
|
||||||
body.charListGrid #rm_print_characters_block .bogus_folder_select .ch_name,
|
body.charListGrid #rm_print_characters_block .bogus_folder_select .ch_name,
|
||||||
body.charListGrid #rm_print_characters_block .character_select .ch_name,
|
body.charListGrid #rm_print_characters_block .character_select .ch_name,
|
||||||
body.charListGrid #rm_print_characters_block .group_select .ch_name {
|
body.charListGrid #rm_print_characters_block .group_select .ch_name,
|
||||||
|
#user_avatar_block.gridView .avatar-container .ch_name {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -55,12 +57,20 @@ body.charListGrid #rm_print_characters_block .group_select .ch_name {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body.charListGrid #rm_print_characters_block .bogus_folder_select .character_name_block,
|
body.charListGrid #rm_print_characters_block .bogus_folder_select .character_name_block,
|
||||||
body.charListGrid #rm_print_characters_block .character_select .character_name_block {
|
body.charListGrid #rm_print_characters_block .character_select .character_name_block,
|
||||||
|
#user_avatar_block.gridView .avatar-container .character_name_block {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#user_avatar_block.gridView .avatar-container .avatar-buttons {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-evenly;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.charListGrid #rm_print_characters_block .bogus_folder_select .character_select_container,
|
body.charListGrid #rm_print_characters_block .bogus_folder_select .character_select_container,
|
||||||
body.charListGrid #rm_print_characters_block .character_select .character_select_container {
|
body.charListGrid #rm_print_characters_block .character_select .character_select_container,
|
||||||
|
#user_avatar_block.gridView .avatar-container .character_select_container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
@@ -83,13 +93,15 @@ body.charListGrid #rm_print_characters_block .bogus_folder_counter_block,
|
|||||||
body.charListGrid #rm_print_characters_block .ch_description,
|
body.charListGrid #rm_print_characters_block .ch_description,
|
||||||
body.charListGrid #rm_print_characters_block .tags_inline,
|
body.charListGrid #rm_print_characters_block .tags_inline,
|
||||||
body.charListGrid #rm_print_characters_block .character_version,
|
body.charListGrid #rm_print_characters_block .character_version,
|
||||||
body.charListGrid #rm_print_characters_block .ch_avatar_url {
|
body.charListGrid #rm_print_characters_block .ch_avatar_url,
|
||||||
|
#user_avatar_block.gridView .avatar-container .ch_description {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*big avatars mode page-wide changes*/
|
/*big avatars mode page-wide changes*/
|
||||||
|
|
||||||
body.big-avatars .character_select .avatar {
|
body.big-avatars .character_select .avatar,
|
||||||
|
body.big-avatars .bogus_folder_select .avatar {
|
||||||
flex: unset;
|
flex: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +161,7 @@ body.big-avatars .avatar_collage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body.big-avatars .ch_description,
|
body.big-avatars .ch_description,
|
||||||
.avatar-container .ch_description {
|
body.big-avatars .avatar-container .ch_description {
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 3;
|
-webkit-line-clamp: 3;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
|
@@ -1294,6 +1294,7 @@
|
|||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, llamacpp" name="dynaTempBlock" class="wide100p">
|
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, llamacpp" name="dynaTempBlock" class="wide100p">
|
||||||
|
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby, llamacpp" name="dynaTempBlock" class="wide100p">
|
||||||
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">
|
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">
|
||||||
<div class="flex-container alignitemscenter" style="justify-content: center;">
|
<div class="flex-container alignitemscenter" style="justify-content: center;">
|
||||||
<div class="checkbox_label" for="dynatemp_textgenerationwebui">
|
<div class="checkbox_label" for="dynatemp_textgenerationwebui">
|
||||||
@@ -3666,7 +3667,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="persona-management-block" class="flex-container wide100p flexGap10">
|
<div id="persona-management-block" class="flex-container wide100p flexGap10">
|
||||||
<div class="flex1">
|
<div class="flex1 overflowHidden wide100p">
|
||||||
<div class="flex-container marginBot10 alignitemscenter">
|
<div class="flex-container marginBot10 alignitemscenter">
|
||||||
<div id="create_dummy_persona" class="menu_button menu_button_icon" title="Create a dummy persona" data-i18n="[title]Create a dummy persona">
|
<div id="create_dummy_persona" class="menu_button menu_button_icon" title="Create a dummy persona" data-i18n="[title]Create a dummy persona">
|
||||||
<i class="fa-solid fa-person-circle-question fa-fw"></i>
|
<i class="fa-solid fa-person-circle-question fa-fw"></i>
|
||||||
@@ -3674,6 +3675,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<input id="persona_search_bar" class="text_pole width100p flex1 margin0" type="search" data-i18n="[placeholder]Search..." placeholder="Search..." maxlength="100">
|
<input id="persona_search_bar" class="text_pole width100p flex1 margin0" type="search" data-i18n="[placeholder]Search..." placeholder="Search..." maxlength="100">
|
||||||
<div id="persona_pagination_container" class="flex1"></div>
|
<div id="persona_pagination_container" class="flex1"></div>
|
||||||
|
<i id="persona_grid_toggle" class="fa-solid fa-table-cells-large menu_button" title="Toggle grid view"></i>
|
||||||
</div>
|
</div>
|
||||||
<div id="user_avatar_block">
|
<div id="user_avatar_block">
|
||||||
<div class="avatar_upload">+</div>
|
<div class="avatar_upload">+</div>
|
||||||
@@ -5336,7 +5338,7 @@
|
|||||||
<div id="rawPromptWrapper" class="tokenItemizingSubclass"></div>
|
<div id="rawPromptWrapper" class="tokenItemizingSubclass"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="user_avatar_template" class="template_element">
|
<div id="user_avatar_template" class="template_element">
|
||||||
<div class="avatar-container wide100p">
|
<div class="avatar-container">
|
||||||
<div imgfile="" class="avatar">
|
<div imgfile="" class="avatar">
|
||||||
<img src="" alt="User Avatar">
|
<img src="" alt="User Avatar">
|
||||||
</div>
|
</div>
|
||||||
|
@@ -821,7 +821,7 @@ async function firstLoadInit() {
|
|||||||
await readSecretState();
|
await readSecretState();
|
||||||
await getClientVersion();
|
await getClientVersion();
|
||||||
await getSettings();
|
await getSettings();
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, user_avatar);
|
||||||
await getCharacters();
|
await getCharacters();
|
||||||
await getBackgrounds();
|
await getBackgrounds();
|
||||||
await initTokenizers();
|
await initTokenizers();
|
||||||
@@ -5400,9 +5400,10 @@ function changeMainAPI() {
|
|||||||
/**
|
/**
|
||||||
* Gets a list of user avatars.
|
* Gets a list of user avatars.
|
||||||
* @param {boolean} doRender Whether to render the list
|
* @param {boolean} doRender Whether to render the list
|
||||||
|
* @param {string} openPageAt Item to be opened at
|
||||||
* @returns {Promise<string[]>} List of avatar file names
|
* @returns {Promise<string[]>} List of avatar file names
|
||||||
*/
|
*/
|
||||||
export async function getUserAvatars(doRender = true) {
|
export async function getUserAvatars(doRender = true, openPageAt = '') {
|
||||||
const response = await fetch('/getuseravatars', {
|
const response = await fetch('/getuseravatars', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
@@ -5418,10 +5419,11 @@ export async function getUserAvatars(doRender = true) {
|
|||||||
|
|
||||||
const storageKey = 'Personas_PerPage';
|
const storageKey = 'Personas_PerPage';
|
||||||
const listId = '#user_avatar_block';
|
const listId = '#user_avatar_block';
|
||||||
|
const perPage = Number(localStorage.getItem(storageKey)) || 5;
|
||||||
|
|
||||||
$('#persona_pagination_container').pagination({
|
$('#persona_pagination_container').pagination({
|
||||||
dataSource: entities,
|
dataSource: entities,
|
||||||
pageSize: Number(localStorage.getItem(storageKey)) || 5,
|
pageSize: perPage,
|
||||||
sizeChangerOptions: [5, 10, 25, 50, 100, 250, 500, 1000],
|
sizeChangerOptions: [5, 10, 25, 50, 100, 250, 500, 1000],
|
||||||
pageRange: 1,
|
pageRange: 1,
|
||||||
pageNumber: savePersonasPage || 1,
|
pageNumber: savePersonasPage || 1,
|
||||||
@@ -5450,6 +5452,15 @@ export async function getUserAvatars(doRender = true) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (openPageAt) {
|
||||||
|
const avatarIndex = entities.indexOf(openPageAt);
|
||||||
|
const page = Math.floor(avatarIndex / perPage) + 1;
|
||||||
|
|
||||||
|
if (avatarIndex !== -1) {
|
||||||
|
$('#persona_pagination_container').pagination('go', page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return allEntities;
|
return allEntities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5563,7 +5574,7 @@ async function uploadUserAvatar(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crop_data = undefined;
|
crop_data = undefined;
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, name || data.path);
|
||||||
},
|
},
|
||||||
error: (jqXHR, exception) => { },
|
error: (jqXHR, exception) => { },
|
||||||
});
|
});
|
||||||
|
@@ -21,6 +21,13 @@ import { persona_description_positions, power_user } from './power-user.js';
|
|||||||
import { getTokenCount } from './tokenizers.js';
|
import { getTokenCount } from './tokenizers.js';
|
||||||
import { debounce, delay, download, parseJsonFile } from './utils.js';
|
import { debounce, delay, download, parseJsonFile } from './utils.js';
|
||||||
|
|
||||||
|
const GRID_STORAGE_KEY = 'Personas_GridView';
|
||||||
|
|
||||||
|
function switchPersonaGridView() {
|
||||||
|
const state = localStorage.getItem(GRID_STORAGE_KEY) === 'true';
|
||||||
|
$('#user_avatar_block').toggleClass('gridView', state);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uploads an avatar file to the server
|
* Uploads an avatar file to the server
|
||||||
* @param {string} url URL for the avatar file
|
* @param {string} url URL for the avatar file
|
||||||
@@ -47,7 +54,7 @@ async function uploadUserAvatar(url, name) {
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
success: async function () {
|
success: async function () {
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, name);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -157,7 +164,7 @@ export async function convertCharacterToPersona(characterId = null) {
|
|||||||
toastr.success(`You can now select ${name} as a persona in the Persona Management menu.`, 'Persona Created');
|
toastr.success(`You can now select ${name} as a persona in the Persona Management menu.`, 'Persona Created');
|
||||||
|
|
||||||
// Refresh the persona selector
|
// Refresh the persona selector
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, overwriteName);
|
||||||
// Reload the persona description
|
// Reload the persona description
|
||||||
setPersonaDescription();
|
setPersonaDescription();
|
||||||
}
|
}
|
||||||
@@ -202,7 +209,7 @@ export function autoSelectPersona(name) {
|
|||||||
export async function updatePersonaNameIfExists(avatarId, newName) {
|
export async function updatePersonaNameIfExists(avatarId, newName) {
|
||||||
if (avatarId in power_user.personas) {
|
if (avatarId in power_user.personas) {
|
||||||
power_user.personas[avatarId] = newName;
|
power_user.personas[avatarId] = newName;
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, avatarId);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
console.log(`Updated persona name for ${avatarId} to ${newName}`);
|
console.log(`Updated persona name for ${avatarId} to ${newName}`);
|
||||||
} else {
|
} else {
|
||||||
@@ -256,7 +263,7 @@ async function bindUserNameToPersona(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, avatarId);
|
||||||
setPersonaDescription();
|
setPersonaDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +486,7 @@ async function setDefaultPersona(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
await getUserAvatars();
|
await getUserAvatars(true, avatarId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateUserLockIcon() {
|
function updateUserLockIcon() {
|
||||||
@@ -633,6 +640,11 @@ export function initPersonas() {
|
|||||||
$('#personas_backup').on('click', onBackupPersonas);
|
$('#personas_backup').on('click', onBackupPersonas);
|
||||||
$('#personas_restore').on('click', () => $('#personas_restore_input').trigger('click'));
|
$('#personas_restore').on('click', () => $('#personas_restore_input').trigger('click'));
|
||||||
$('#personas_restore_input').on('change', onPersonasRestoreInput);
|
$('#personas_restore_input').on('change', onPersonasRestoreInput);
|
||||||
|
$('#persona_grid_toggle').on('click', () => {
|
||||||
|
const state = localStorage.getItem(GRID_STORAGE_KEY) === 'true';
|
||||||
|
localStorage.setItem(GRID_STORAGE_KEY, String(!state));
|
||||||
|
switchPersonaGridView();
|
||||||
|
});
|
||||||
|
|
||||||
eventSource.on('charManagementDropdown', (target) => {
|
eventSource.on('charManagementDropdown', (target) => {
|
||||||
if (target === 'convert_to_persona') {
|
if (target === 'convert_to_persona') {
|
||||||
@@ -640,4 +652,5 @@ export function initPersonas() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
eventSource.on(event_types.CHAT_CHANGED, setChatLockedPersona);
|
eventSource.on(event_types.CHAT_CHANGED, setChatLockedPersona);
|
||||||
|
switchPersonaGridView();
|
||||||
}
|
}
|
||||||
|
@@ -1521,6 +1521,10 @@ select option:not(:checked) {
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#persona_search_bar {
|
||||||
|
min-width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
input[type=search]::-webkit-search-cancel-button {
|
input[type=search]::-webkit-search-cancel-button {
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
@@ -1586,10 +1590,10 @@ input[type=search]:focus::-webkit-search-cancel-button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*applies to both groups and solos chars in the char list*/
|
/*applies to both groups and solos chars in the char list*/
|
||||||
#rm_print_characters_block .ch_name {
|
#rm_print_characters_block .ch_name,
|
||||||
|
.avatar-container .ch_name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
/* max-width: calc(100% - 29px); */
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
display: block;
|
display: block;
|
||||||
@@ -1828,6 +1832,9 @@ input[type=search]:focus::-webkit-search-cancel-button {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
|
width: 100%;
|
||||||
|
outline: 2px solid transparent;
|
||||||
|
border: 2px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
grammarly-extension {
|
grammarly-extension {
|
||||||
@@ -2272,7 +2279,7 @@ input[type="checkbox"]:not(#nav-toggle):not(#rm_button_panel_pin):not(#lm_button
|
|||||||
#user_avatar_block {
|
#user_avatar_block {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-evenly;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-container .avatar {
|
.avatar-container .avatar {
|
||||||
@@ -2284,11 +2291,6 @@ input[type="checkbox"]:not(#nav-toggle):not(#rm_button_panel_pin):not(#lm_button
|
|||||||
outline: 2px solid transparent;
|
outline: 2px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar-container {
|
|
||||||
outline: 2px solid transparent;
|
|
||||||
border: 2px solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar-container.selected {
|
.avatar-container.selected {
|
||||||
border: 2px solid rgba(255, 255, 255, 0.7);
|
border: 2px solid rgba(255, 255, 255, 0.7);
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,10 @@ router.post('/libre', jsonParser, async (request, response) => {
|
|||||||
return response.sendStatus(400);
|
return response.sendStatus(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.body.lang === 'zh-CN' || request.body.lang === 'zh-TW') {
|
||||||
|
request.body.lang = 'zh';
|
||||||
|
}
|
||||||
|
|
||||||
const text = request.body.text;
|
const text = request.body.text;
|
||||||
const lang = request.body.lang;
|
const lang = request.body.lang;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user