mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'dev' into feature/tags
This commit is contained in:
@ -2496,10 +2496,10 @@
|
|||||||
<select id="char-management-dropdown">
|
<select id="char-management-dropdown">
|
||||||
<option value="default" disabled selected>More...</option>
|
<option value="default" disabled selected>More...</option>
|
||||||
<option id="set_character_world">
|
<option id="set_character_world">
|
||||||
<i class="fa-solid fa-globe"></i> Link to World Info
|
Link to World Info
|
||||||
</option>
|
</option>
|
||||||
<option id="import_character_info">
|
<option id="import_character_info">
|
||||||
<i class="fa-solid fa-file-import"></i> Import Card Lore
|
Import Card Lore
|
||||||
</option>
|
</option>
|
||||||
<option id="set_chat_scenario">
|
<option id="set_chat_scenario">
|
||||||
Scenario Override
|
Scenario Override
|
||||||
@ -2662,7 +2662,9 @@
|
|||||||
<div name="Unadded Char List" class="flex-container flexFlowColumn overflowYAuto flex1">
|
<div name="Unadded Char List" class="flex-container flexFlowColumn overflowYAuto flex1">
|
||||||
<div id="rm_group_add_members_header">
|
<div id="rm_group_add_members_header">
|
||||||
<input id="rm_group_filter" class="text_pole margin0" type="search" placeholder="Filter..." maxlength="100" />
|
<input id="rm_group_filter" class="text_pole margin0" type="search" placeholder="Filter..." maxlength="100" />
|
||||||
<div id="group_fav_filter" class="menu_button fa-solid fa-ranking-star margin0" title="Show only favorites"></div>
|
</div>
|
||||||
|
<div class="rm_tag_controls">
|
||||||
|
<div class="tags rm_tag_filter"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="rm_group_add_members" class="overflowYAuto flex-container"></div>
|
<div id="rm_group_add_members" class="overflowYAuto flex-container"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -2698,7 +2700,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
<div class="rm_tag_controls">
|
<div class="rm_tag_controls">
|
||||||
<div id="rm_tag_filter" class="tags"></div>
|
<div class="tags rm_tag_filter"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="rm_print_characters_block"></div>
|
<div id="rm_print_characters_block"></div>
|
||||||
@ -2743,23 +2745,24 @@
|
|||||||
|
|
||||||
<div class="inline-drawer">
|
<div class="inline-drawer">
|
||||||
<div class="inline-drawer-toggle inline-drawer-header">
|
<div class="inline-drawer-toggle inline-drawer-header">
|
||||||
<h4>
|
<h4>Prompt Overrides <small>(For OpenAI/Claude APIs, and Instruct mode)</small></h4>
|
||||||
AI Prompt Overrides
|
|
||||||
<small>(Affects the generation)</small>
|
|
||||||
</h4>
|
|
||||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-drawer-content">
|
<div class="inline-drawer-content">
|
||||||
|
<small>Insert {{original}} into either box to include the respective default prompt from system settings.</small>
|
||||||
<div>
|
<div>
|
||||||
<h4>System Prompt</h4>
|
<h4>Main Prompt</h4>
|
||||||
<textarea id="system_prompt_textarea" name="system_prompt" placeholder="(Overrides the main prompt for Chat Completion and/or system prompt for Instruct Mode if not empty. Use {{original}} macro to insert the original prompt.)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
|
<textarea id="system_prompt_textarea" name="system_prompt" placeholder="Any contents here will replace the default Main Prompt used for this character. (v2 spec: system_prompt)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>Post History Instructions</h4>
|
<h4>Jailbreak</h4>
|
||||||
<textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="(Overrides the default jailbreak for Chat Completion if not empty. Use {{original}} macro to insert the original jailbreak.)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
|
<textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="Any contents here will replace the default Jailbreak Prompt used for this character. (v2 spec: post_history_instructions)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<div class="inline-drawer">
|
<div class="inline-drawer">
|
||||||
<div class="inline-drawer-toggle inline-drawer-header">
|
<div class="inline-drawer-toggle inline-drawer-header">
|
||||||
<h4>
|
<h4>
|
||||||
@ -2769,25 +2772,30 @@
|
|||||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="inline-drawer-content">
|
<div class="inline-drawer-content">
|
||||||
<div>
|
<small>Everything here is optional</small>
|
||||||
<h4>Creator's Name</h4>
|
<div class="flex-container flexnowrap">
|
||||||
<textarea id="creator_textarea" name="creator" placeholder="(Botmaker's name / Contact info)" form="form_create" class="text_pole" autocomplete="off" rows="1" maxlength="2000"></textarea>
|
<div class="flex1">
|
||||||
|
<h4>Created by</h4>
|
||||||
|
<textarea id="creator_textarea" name="creator" placeholder="(Botmaker's name / Contact info)" form="form_create" class="text_pole" autocomplete="off" rows="2" maxlength="2000"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="flex1">
|
||||||
|
<h4>Character Version</h4>
|
||||||
|
<textarea id="character_version_textarea" name="character_version" placeholder="(If you want to track character versions)" form="form_create" class="text_pole" autocomplete="off" rows="2" maxlength="200"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex-container flexnowrap">
|
||||||
<h4>Creator's Notes</h4>
|
<div class="flex1">
|
||||||
<textarea id="creator_notes_textarea" name="creator_notes" placeholder="(Displays in the characters list. Describe the bot to the user, list the chat models it has been tested on, and any other useful tips)" form="form_create" class="text_pole" autocomplete="off" rows="2" maxlength="20000"></textarea>
|
<h4>Creator's Notes</h4>
|
||||||
</div>
|
<textarea id="creator_notes_textarea" name="creator_notes" placeholder="(Describe the bot, give use tips, or list the chat models it has been tested on. This will be displayed in the character list.)" form="form_create" class="text_pole" autocomplete="off" rows="4" maxlength="20000"></textarea>
|
||||||
<div>
|
</div>
|
||||||
<h4>Creator's Tags</h4>
|
<div class="flex1">
|
||||||
<textarea id="tags_textarea" name="tags" placeholder="(List of freeform comma-separated tags)" form="form_create" class="text_pole" autocomplete="off" rows="1" maxlength="2000"></textarea>
|
<h4>Tags to Embed</h4>
|
||||||
</div>
|
<textarea id="tags_textarea" name="tags" placeholder="(Write a comma-separated list of tags)" form="form_create" class="text_pole" autocomplete="off" rows="4" maxlength="2000"></textarea>
|
||||||
<div>
|
</div>
|
||||||
<h4>Character Version</h4>
|
|
||||||
<textarea id="character_version_textarea" name="character_version" placeholder="(Optional string to track character versions)" form="form_create" class="text_pole" autocomplete="off" rows="1" maxlength="2000"></textarea>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<div id="personality_div">
|
<div id="personality_div">
|
||||||
<h4>
|
<h4>
|
||||||
<span data-i18n="Personality summary">Personality summary</span>
|
<span data-i18n="Personality summary">Personality summary</span>
|
||||||
@ -3268,7 +3276,11 @@
|
|||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<img alt="Avatar" src="" />
|
<img alt="Avatar" src="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ch_name"></div>
|
<div class="group_member_name">
|
||||||
|
<div class="ch_name"></div>
|
||||||
|
<div class="tags tags_inline"></div>
|
||||||
|
</div>
|
||||||
|
<input class="ch_fav" value="" hidden />
|
||||||
<div class="group_member_icon">
|
<div class="group_member_icon">
|
||||||
<div title="Temporarily disable automatic replies from this character" data-action="disable" class="right_menu_button fa-solid fa-lg fa-comment-slash"></div>
|
<div title="Temporarily disable automatic replies from this character" data-action="disable" class="right_menu_button fa-solid fa-lg fa-comment-slash"></div>
|
||||||
<div title="Enable automatic replies from this character" data-action="enable" class="right_menu_button fa-solid fa-lg fa-comment-slash"></div>
|
<div title="Enable automatic replies from this character" data-action="enable" class="right_menu_button fa-solid fa-lg fa-comment-slash"></div>
|
||||||
@ -3460,4 +3472,4 @@
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -142,12 +142,13 @@ import {
|
|||||||
tag_map,
|
tag_map,
|
||||||
tags,
|
tags,
|
||||||
loadTagsSettings,
|
loadTagsSettings,
|
||||||
printTags,
|
printTagFilters,
|
||||||
getTagsList,
|
getTagsList,
|
||||||
appendTagToList,
|
appendTagToList,
|
||||||
createTagMapFromList,
|
createTagMapFromList,
|
||||||
renameTagKey,
|
renameTagKey,
|
||||||
importTags,
|
importTags,
|
||||||
|
tag_filter_types,
|
||||||
} from "./scripts/tags.js";
|
} from "./scripts/tags.js";
|
||||||
import {
|
import {
|
||||||
SECRET_KEYS,
|
SECRET_KEYS,
|
||||||
@ -833,7 +834,8 @@ async function printCharacters() {
|
|||||||
$("#rm_print_characters_block").append(template);
|
$("#rm_print_characters_block").append(template);
|
||||||
});
|
});
|
||||||
|
|
||||||
printTags();
|
printTagFilters(tag_filter_types.character);
|
||||||
|
printTagFilters(tag_filter_types.group_member);
|
||||||
printGroups();
|
printGroups();
|
||||||
sortCharactersList();
|
sortCharactersList();
|
||||||
favsToHotswap();
|
favsToHotswap();
|
||||||
@ -4651,7 +4653,7 @@ function selectKoboldGuiPreset() {
|
|||||||
|
|
||||||
async function saveSettings(type) {
|
async function saveSettings(type) {
|
||||||
//console.log('Entering settings with name1 = '+name1);
|
//console.log('Entering settings with name1 = '+name1);
|
||||||
eventSource.emit(event_types.SETTINGS_UPDATED);
|
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/savesettings",
|
url: "/savesettings",
|
||||||
@ -4699,6 +4701,7 @@ async function saveSettings(type) {
|
|||||||
//processData: false,
|
//processData: false,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
//online_status = data.result;
|
//online_status = data.result;
|
||||||
|
eventSource.emit(event_types.SETTINGS_UPDATED);
|
||||||
if (type == "change_name") {
|
if (type == "change_name") {
|
||||||
clearChat();
|
clearChat();
|
||||||
printMessages();
|
printMessages();
|
||||||
@ -5519,11 +5522,12 @@ function openCharacterWorldPopup() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSelectCharacterWorld() {
|
async function onSelectCharacterWorld() {
|
||||||
const value = $('.character_world_info_selector').find('option:selected').val();
|
const value = $('.character_world_info_selector').find('option:selected').val();
|
||||||
const worldIndex = value !== '' ? Number(value) : NaN;
|
const worldIndex = value !== '' ? Number(value) : NaN;
|
||||||
const name = !isNaN(worldIndex) ? world_names[worldIndex] : '';
|
const name = !isNaN(worldIndex) ? world_names[worldIndex] : '';
|
||||||
|
|
||||||
|
const previousValue = $('#character_world').val();
|
||||||
$('#character_world').val(name);
|
$('#character_world').val(name);
|
||||||
|
|
||||||
console.debug('Character world selected:', name);
|
console.debug('Character world selected:', name);
|
||||||
@ -5531,7 +5535,23 @@ function openCharacterWorldPopup() {
|
|||||||
if (menu_type == 'create') {
|
if (menu_type == 'create') {
|
||||||
create_save.world = name;
|
create_save.world = name;
|
||||||
} else {
|
} else {
|
||||||
createOrEditCharacter();
|
if (previousValue && !name) {
|
||||||
|
try {
|
||||||
|
// Dirty hack to remove embedded lorebook from character JSON data.
|
||||||
|
const data = JSON.parse($('#character_json_data').val());
|
||||||
|
|
||||||
|
if (data?.data?.character_book) {
|
||||||
|
data.data.character_book = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#character_json_data').val(JSON.stringify(data));
|
||||||
|
toastr.info('Embedded lorebook will be removed from this character.');
|
||||||
|
} catch {
|
||||||
|
console.error('Failed to parse character JSON data.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await createOrEditCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
setWorldInfoButtonClass(undefined, !!value);
|
setWorldInfoButtonClass(undefined, !!value);
|
||||||
@ -6301,6 +6321,7 @@ function importCharacter(file) {
|
|||||||
processData: false,
|
processData: false,
|
||||||
success: async function (data) {
|
success: async function (data) {
|
||||||
if (data.file_name !== undefined) {
|
if (data.file_name !== undefined) {
|
||||||
|
$('#character_search_bar').val('').trigger('input');
|
||||||
$("#rm_info_block").transition({ opacity: 0, duration: 0 });
|
$("#rm_info_block").transition({ opacity: 0, duration: 0 });
|
||||||
var $prev_img = $("#avatar_div_div").clone();
|
var $prev_img = $("#avatar_div_div").clone();
|
||||||
$prev_img
|
$prev_img
|
||||||
|
@ -561,8 +561,8 @@ B: ${oldBottom}>> ${bottom}
|
|||||||
---`)
|
---`)
|
||||||
power_user.movingUIState[elmntName].margin = 'unset';
|
power_user.movingUIState[elmntName].margin = 'unset';
|
||||||
} else {
|
} else {
|
||||||
console.log('skipped unsetting margins')
|
console.debug('skipped unsetting margins')
|
||||||
console.log(oldTop, top, oldLeft, left)
|
//console.debug(oldTop, top, oldLeft, left)
|
||||||
}
|
}
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ async function visualNovelSetCharacterSprites(container, name, expression) {
|
|||||||
template.attr('data-avatar', avatar);
|
template.attr('data-avatar', avatar);
|
||||||
template.find('.drag-grabber').attr('id', `expression-${avatar}header`);
|
template.find('.drag-grabber').attr('id', `expression-${avatar}header`);
|
||||||
$('#visual-novel-wrapper').append(template);
|
$('#visual-novel-wrapper').append(template);
|
||||||
dragElement(template[0]);
|
dragElement($(template[0]));
|
||||||
template.toggleClass('hidden', noSprites);
|
template.toggleClass('hidden', noSprites);
|
||||||
setImage(template.find('img'), defaultSpritePath || '');
|
setImage(template.find('img'), defaultSpritePath || '');
|
||||||
const fadeInPromise = new Promise(resolve => {
|
const fadeInPromise = new Promise(resolve => {
|
||||||
@ -533,6 +533,11 @@ function drawSpritesList(character, labels, sprites) {
|
|||||||
$('.expression_settings').show();
|
$('.expression_settings').show();
|
||||||
$('#image_list').empty();
|
$('#image_list').empty();
|
||||||
$('#image_list').data('name', character);
|
$('#image_list').data('name', character);
|
||||||
|
|
||||||
|
if (!Array.isArray(labels)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
labels.sort().forEach((item) => {
|
labels.sort().forEach((item) => {
|
||||||
const sprite = sprites.find(x => x.label == item);
|
const sprite = sprites.find(x => x.label == item);
|
||||||
|
|
||||||
|
@ -974,12 +974,19 @@ function select_group_chats(groupId, skipAnimation) {
|
|||||||
? getThumbnailUrl('avatar', character.avatar)
|
? getThumbnailUrl('avatar', character.avatar)
|
||||||
: default_avatar;
|
: default_avatar;
|
||||||
const template = $("#group_member_template .group_member").clone();
|
const template = $("#group_member_template .group_member").clone();
|
||||||
|
const isFav = character.fav || character.fav == 'true';
|
||||||
template.data("id", character.avatar);
|
template.data("id", character.avatar);
|
||||||
template.find(".avatar img").attr("src", avatar);
|
template.find(".avatar img").attr("src", avatar);
|
||||||
template.find(".avatar img").attr("title", character.avatar);
|
template.find(".avatar img").attr("title", character.avatar);
|
||||||
template.find(".ch_name").text(character.name);
|
template.find(".ch_name").text(character.name);
|
||||||
template.attr("chid", characters.indexOf(character));
|
template.attr("chid", characters.indexOf(character));
|
||||||
template.toggleClass('is_fav', character.fav || character.fav == 'true');
|
template.find('.ch_fav').val(isFav);
|
||||||
|
template.toggleClass('is_fav', isFav);
|
||||||
|
|
||||||
|
// Display inline tags
|
||||||
|
const tags = getTagsList(character.avatar);
|
||||||
|
const tagsElement = template.find('.tags');
|
||||||
|
tags.forEach(tag => appendTagToList(tagsElement, tag, {}));
|
||||||
|
|
||||||
if (!group) {
|
if (!group) {
|
||||||
template.find('[data-action="speak"]').hide();
|
template.find('[data-action="speak"]').hide();
|
||||||
@ -999,7 +1006,6 @@ function select_group_chats(groupId, skipAnimation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sortGroupMembers("#rm_group_add_members .group_member");
|
sortGroupMembers("#rm_group_add_members .group_member");
|
||||||
filterMembersByFavorites(false);
|
|
||||||
|
|
||||||
const groupHasMembers = !!$("#rm_group_members").children().length;
|
const groupHasMembers = !!$("#rm_group_members").children().length;
|
||||||
$("#rm_group_submit").prop("disabled", !groupHasMembers);
|
$("#rm_group_submit").prop("disabled", !groupHasMembers);
|
||||||
@ -1278,24 +1284,6 @@ async function createGroup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleFilterByFavorites() {
|
|
||||||
filterMembersByFavorites(!fav_filter_on);
|
|
||||||
}
|
|
||||||
|
|
||||||
function filterMembersByFavorites(value) {
|
|
||||||
fav_filter_on = value;
|
|
||||||
$('#group_fav_filter').toggleClass('fav_on', fav_filter_on);
|
|
||||||
|
|
||||||
if (!fav_filter_on) {
|
|
||||||
$("#rm_group_add_members .group_member").removeClass('hiddenByFav');
|
|
||||||
} else {
|
|
||||||
$("#rm_group_add_members .group_member").each(function () {
|
|
||||||
const isValidSearch = $(this).hasClass("is_fav");
|
|
||||||
$(this).toggleClass('hiddenByFav', !isValidSearch);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createNewGroupChat(groupId) {
|
export async function createNewGroupChat(groupId) {
|
||||||
const group = groups.find(x => x.id === groupId);
|
const group = groups.find(x => x.id === groupId);
|
||||||
|
|
||||||
@ -1491,7 +1479,6 @@ function stopAutoModeGeneration() {
|
|||||||
jQuery(() => {
|
jQuery(() => {
|
||||||
$(document).on("click", ".group_select", selectGroup);
|
$(document).on("click", ".group_select", selectGroup);
|
||||||
$("#rm_group_filter").on("input", filterGroupMembers);
|
$("#rm_group_filter").on("input", filterGroupMembers);
|
||||||
$("#group_fav_filter").on("click", toggleFilterByFavorites);
|
|
||||||
$("#rm_group_submit").on("click", createGroup);
|
$("#rm_group_submit").on("click", createGroup);
|
||||||
$("#rm_group_scenario").on("click", setScenarioOverride);
|
$("#rm_group_scenario").on("click", setScenarioOverride);
|
||||||
$("#rm_group_automode").on("input", function () {
|
$("#rm_group_automode").on("input", function () {
|
||||||
|
@ -990,8 +990,11 @@ function loadOpenAISettings(data, settings) {
|
|||||||
|
|
||||||
$('#stream_toggle').prop('checked', oai_settings.stream_openai);
|
$('#stream_toggle').prop('checked', oai_settings.stream_openai);
|
||||||
|
|
||||||
|
$('#model_openai_select').val(oai_settings.openai_model);
|
||||||
$(`#model_openai_select option[value="${oai_settings.openai_model}"`).attr('selected', true);
|
$(`#model_openai_select option[value="${oai_settings.openai_model}"`).attr('selected', true);
|
||||||
|
$('#model_claude_select').val(oai_settings.claude_model);
|
||||||
$(`#model_claude_select option[value="${oai_settings.claude_model}"`).attr('selected', true);
|
$(`#model_claude_select option[value="${oai_settings.claude_model}"`).attr('selected', true);
|
||||||
|
$('#model_windowai_select').val(oai_settings.windowai_model);
|
||||||
$(`#model_windowai_select option[value="${oai_settings.windowai_model}"`).attr('selected', true);
|
$(`#model_windowai_select option[value="${oai_settings.windowai_model}"`).attr('selected', true);
|
||||||
$('#openai_max_context').val(oai_settings.openai_max_context);
|
$('#openai_max_context').val(oai_settings.openai_max_context);
|
||||||
$('#openai_max_context_counter').text(`${oai_settings.openai_max_context}`);
|
$('#openai_max_context_counter').text(`${oai_settings.openai_max_context}`);
|
||||||
|
@ -929,68 +929,43 @@ async function saveTheme() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetMovablePanels() {
|
function resetMovablePanels() {
|
||||||
document.getElementById("sheld").style.top = '';
|
const panelIds = [
|
||||||
document.getElementById("sheld").style.left = '';
|
'sheld',
|
||||||
document.getElementById("sheld").style.bottom = '';
|
'left-nav-panel',
|
||||||
document.getElementById("sheld").style.right = '';
|
'right-nav-panel',
|
||||||
document.getElementById("sheld").style.height = '';
|
'WorldInfo',
|
||||||
document.getElementById("sheld").style.width = '';
|
'floatingPrompt',
|
||||||
document.getElementById("sheld").style.margin = '';
|
'expression-holder',
|
||||||
|
];
|
||||||
|
|
||||||
|
const panelStyles = ['top', 'left', 'right', 'bottom', 'height', 'width', 'margin',];
|
||||||
|
|
||||||
document.getElementById("left-nav-panel").style.top = '';
|
panelIds.forEach((id) => {
|
||||||
document.getElementById("left-nav-panel").style.left = '';
|
const panel = document.getElementById(id);
|
||||||
document.getElementById("left-nav-panel").style.height = '';
|
|
||||||
document.getElementById("left-nav-panel").style.width = '';
|
|
||||||
document.getElementById("left-nav-panel").style.margin = '';
|
|
||||||
|
|
||||||
document.getElementById("right-nav-panel").style.top = '';
|
if (panel) {
|
||||||
document.getElementById("right-nav-panel").style.left = '';
|
panelStyles.forEach((style) => {
|
||||||
document.getElementById("right-nav-panel").style.right = '';
|
panel.style[style] = '';
|
||||||
document.getElementById("right-nav-panel").style.height = '';
|
});
|
||||||
document.getElementById("right-nav-panel").style.width = '';
|
}
|
||||||
document.getElementById("right-nav-panel").style.margin = '';
|
});
|
||||||
|
|
||||||
document.getElementById("WorldInfo").style.top = '';
|
const zoomedAvatar = document.querySelector('.zoomed_avatar');
|
||||||
document.getElementById("WorldInfo").style.left = '';
|
if (zoomedAvatar) {
|
||||||
document.getElementById("WorldInfo").style.right = '';
|
panelStyles.forEach((style) => {
|
||||||
document.getElementById("WorldInfo").style.bottom = '';
|
zoomedAvatar.style[style] = '';
|
||||||
document.getElementById("WorldInfo").style.height = '';
|
});
|
||||||
document.getElementById("WorldInfo").style.width = '';
|
|
||||||
document.getElementById("WorldInfo").style.margin = '';
|
|
||||||
|
|
||||||
document.getElementById("floatingPrompt").style.top = '';
|
|
||||||
document.getElementById("floatingPrompt").style.left = '';
|
|
||||||
document.getElementById("floatingPrompt").style.right = '';
|
|
||||||
document.getElementById("floatingPrompt").style.bottom = '';
|
|
||||||
document.getElementById("floatingPrompt").style.height = '';
|
|
||||||
document.getElementById("floatingPrompt").style.width = '';
|
|
||||||
document.getElementById("floatingPrompt").style.margin = '';
|
|
||||||
|
|
||||||
if ($("#expression-holder")) {
|
|
||||||
document.getElementById("expression-holder").style.top = '';
|
|
||||||
document.getElementById("expression-holder").style.left = '';
|
|
||||||
document.getElementById("expression-holder").style.right = '';
|
|
||||||
document.getElementById("expression-holder").style.bottom = '';
|
|
||||||
document.getElementById("expression-holder").style.height = '';
|
|
||||||
document.getElementById("expression-holder").style.width = '';
|
|
||||||
document.getElementById("expression-holder").style.margin = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(".zoomed_avatar")) {
|
$('[data-dragged="true"]').removeAttr('data-dragged');
|
||||||
$(".zoomed_avatar").css('top', '');
|
power_user.movingUIState = {};
|
||||||
$(".zoomed_avatar").css('left', '');
|
|
||||||
$(".zoomed_avatar").css('right', '');
|
|
||||||
$(".zoomed_avatar").css('bottom', '');
|
|
||||||
$(".zoomed_avatar").css('width', '');
|
|
||||||
$(".zoomed_avatar").css('height', '');
|
|
||||||
$(".zoomed_avatar").css('margin', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('*[data-dragged="true"]').removeAttr('data-dragged');
|
|
||||||
power_user.movingUIState = {}
|
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
eventSource.emit(event_types.MOVABLE_PANELS_RESET);
|
eventSource.emit(event_types.MOVABLE_PANELS_RESET);
|
||||||
|
|
||||||
|
eventSource.once(event_types.SETTINGS_UPDATED, () => {
|
||||||
|
toastr.success('Panel positions reset');
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doNewChat() {
|
function doNewChat() {
|
||||||
|
@ -14,7 +14,7 @@ export {
|
|||||||
tags,
|
tags,
|
||||||
tag_map,
|
tag_map,
|
||||||
loadTagsSettings,
|
loadTagsSettings,
|
||||||
printTags,
|
printTagFilters,
|
||||||
isElementTagged,
|
isElementTagged,
|
||||||
getTagsList,
|
getTagsList,
|
||||||
appendTagToList,
|
appendTagToList,
|
||||||
@ -26,12 +26,28 @@ export {
|
|||||||
const random_id = () => Math.round(Date.now() * Math.random()).toString();
|
const random_id = () => Math.round(Date.now() * Math.random()).toString();
|
||||||
const TAG_LOGIC_AND = true; // switch to false to use OR logic for combining tags
|
const TAG_LOGIC_AND = true; // switch to false to use OR logic for combining tags
|
||||||
const CHARACTER_SELECTOR = '#rm_print_characters_block > div';
|
const CHARACTER_SELECTOR = '#rm_print_characters_block > div';
|
||||||
|
const GROUP_MEMBER_SELECTOR = '#rm_group_add_members > div';
|
||||||
|
const CHARACTER_FILTER_SELECTOR = '#rm_characters_block .rm_tag_filter';
|
||||||
|
const GROUP_FILTER_SELECTOR = '#rm_group_chats_block .rm_tag_filter';
|
||||||
|
|
||||||
|
function getCharacterSelector(listSelector) {
|
||||||
|
if ($(listSelector).is(GROUP_FILTER_SELECTOR)) {
|
||||||
|
return GROUP_MEMBER_SELECTOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CHARACTER_SELECTOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const tag_filter_types = {
|
||||||
|
character: 0,
|
||||||
|
group_member: 1,
|
||||||
|
};
|
||||||
|
|
||||||
const ACTIONABLE_TAGS = {
|
const ACTIONABLE_TAGS = {
|
||||||
|
|
||||||
FAV: { id: 1, name: 'Show only favorites', color: 'rgba(255, 255, 0, 0.5)', action: applyFavFilter, icon: 'fa-solid fa-star' },
|
FAV: { id: 1, name: 'Show only favorites', color: 'rgba(255, 255, 0, 0.5)', action: applyFavFilter, icon: 'fa-solid fa-star', class: 'filterByFavorites' },
|
||||||
GROUP: { id: 0, name: 'Show only groups', color: 'rgba(100, 100, 100, 0.5)', action: filterByGroups, icon: 'fa-solid fa-users' },
|
GROUP: { id: 0, name: 'Show only groups', color: 'rgba(100, 100, 100, 0.5)', action: filterByGroups, icon: 'fa-solid fa-users', class: 'filterByGroups' },
|
||||||
HINT: { id: 3, name: 'Show Tag List', color: 'rgba(150, 100, 100, 0.5)', action: onTagListHintClick, icon: 'fa-solid fa-tags' },
|
HINT: { id: 3, name: 'Show Tag List', color: 'rgba(150, 100, 100, 0.5)', action: onTagListHintClick, icon: 'fa-solid fa-tags', class: 'showTagList' },
|
||||||
}
|
}
|
||||||
|
|
||||||
const InListActionable = {
|
const InListActionable = {
|
||||||
@ -50,14 +66,14 @@ const DEFAULT_TAGS = [
|
|||||||
let tags = [];
|
let tags = [];
|
||||||
let tag_map = {};
|
let tag_map = {};
|
||||||
|
|
||||||
function applyFavFilter() {
|
function applyFavFilter(characterSelector) {
|
||||||
const isSelected = $(this).hasClass('selected');
|
const isSelected = $(this).hasClass('selected');
|
||||||
const displayFavoritesOnly = !isSelected;
|
const displayFavoritesOnly = !isSelected;
|
||||||
|
|
||||||
$(this).toggleClass('selected', displayFavoritesOnly);
|
$(this).toggleClass('selected', displayFavoritesOnly);
|
||||||
$(CHARACTER_SELECTOR).removeClass('hiddenByFav');
|
$(characterSelector).removeClass('hiddenByFav');
|
||||||
|
|
||||||
$(CHARACTER_SELECTOR).each(function () {
|
$(characterSelector).each(function () {
|
||||||
if (displayFavoritesOnly) {
|
if (displayFavoritesOnly) {
|
||||||
if ($(this).find(".ch_fav").length !== 0) {
|
if ($(this).find(".ch_fav").length !== 0) {
|
||||||
const shouldBeDisplayed = $(this).find(".ch_fav").val().toLowerCase().includes(true);
|
const shouldBeDisplayed = $(this).find(".ch_fav").val().toLowerCase().includes(true);
|
||||||
@ -69,13 +85,13 @@ function applyFavFilter() {
|
|||||||
updateVisibleDivs('#rm_print_characters_block', true);
|
updateVisibleDivs('#rm_print_characters_block', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterByGroups() {
|
function filterByGroups(characterSelector) {
|
||||||
const isSelected = $(this).hasClass('selected');
|
const isSelected = $(this).hasClass('selected');
|
||||||
const displayGroupsOnly = !isSelected;
|
const displayGroupsOnly = !isSelected;
|
||||||
$(this).toggleClass('selected', displayGroupsOnly);
|
$(this).toggleClass('selected', displayGroupsOnly);
|
||||||
$(CHARACTER_SELECTOR).removeClass('hiddenByGroup');
|
$(characterSelector).removeClass('hiddenByGroup');
|
||||||
|
|
||||||
$(CHARACTER_SELECTOR).each((_, element) => {
|
$(characterSelector).each((_, element) => {
|
||||||
$(element).toggleClass('hiddenByGroup', displayGroupsOnly && !$(element).hasClass('group_select'));
|
$(element).toggleClass('hiddenByGroup', displayGroupsOnly && !$(element).hasClass('group_select'));
|
||||||
});
|
});
|
||||||
updateVisibleDivs('#rm_print_characters_block', true);
|
updateVisibleDivs('#rm_print_characters_block', true);
|
||||||
@ -197,7 +213,8 @@ function selectTag(event, ui, listSelector) {
|
|||||||
appendTagToList(getInlineListSelector(), tag, { removable: false });
|
appendTagToList(getInlineListSelector(), tag, { removable: false });
|
||||||
addTagToMap(tag.id);
|
addTagToMap(tag.id);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
printTags();
|
printTagFilters(tag_filter_types.character);
|
||||||
|
printTagFilters(tag_filter_types.group_member);
|
||||||
|
|
||||||
// need to return false to keep the input clear
|
// need to return false to keep the input clear
|
||||||
return false;
|
return false;
|
||||||
@ -264,6 +281,8 @@ function appendTagToList(listElement, tag, { removable, selectable, action }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const characterSelector = getCharacterSelector($(listElement));
|
||||||
|
|
||||||
let tagElement = $('#tag_template .tag').clone();
|
let tagElement = $('#tag_template .tag').clone();
|
||||||
tagElement.attr('id', tag.id);
|
tagElement.attr('id', tag.id);
|
||||||
|
|
||||||
@ -274,16 +293,20 @@ function appendTagToList(listElement, tag, { removable, selectable, action }) {
|
|||||||
const removeButton = tagElement.find(".tag_remove");
|
const removeButton = tagElement.find(".tag_remove");
|
||||||
removable ? removeButton.show() : removeButton.hide();
|
removable ? removeButton.show() : removeButton.hide();
|
||||||
|
|
||||||
|
if (tag.class) {
|
||||||
|
tagElement.addClass(tag.class);
|
||||||
|
}
|
||||||
|
|
||||||
if (tag.icon) {
|
if (tag.icon) {
|
||||||
tagElement.find('.tag_name').text('').attr('title', tag.name).addClass(tag.icon);
|
tagElement.find('.tag_name').text('').attr('title', tag.name).addClass(tag.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectable) {
|
if (selectable) {
|
||||||
tagElement.on('click', () => onTagFilterClick.bind(tagElement)(listElement));
|
tagElement.on('click', () => onTagFilterClick.bind(tagElement)(listElement, characterSelector));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action) {
|
if (action) {
|
||||||
tagElement.on('click', () => action.bind(tagElement)());
|
tagElement.on('click', () => action.bind(tagElement)(characterSelector));
|
||||||
tagElement.addClass('actionable');
|
tagElement.addClass('actionable');
|
||||||
}
|
}
|
||||||
if (action && tag.id === 2) {
|
if (action && tag.id === 2) {
|
||||||
@ -293,7 +316,7 @@ function appendTagToList(listElement, tag, { removable, selectable, action }) {
|
|||||||
$(listElement).append(tagElement);
|
$(listElement).append(tagElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTagFilterClick(listElement) {
|
function onTagFilterClick(listElement, characterSelector) {
|
||||||
if ($(this).hasClass('selected')) {
|
if ($(this).hasClass('selected')) {
|
||||||
$(this).removeClass('selected');
|
$(this).removeClass('selected');
|
||||||
$(this).addClass('excluded');
|
$(this).addClass('excluded');
|
||||||
@ -307,7 +330,7 @@ function onTagFilterClick(listElement) {
|
|||||||
|
|
||||||
const tagIds = [...($(listElement).find(".tag.selected:not(.actionable)").map((_, el) => $(el).attr("id")))];
|
const tagIds = [...($(listElement).find(".tag.selected:not(.actionable)").map((_, el) => $(el).attr("id")))];
|
||||||
const excludedTagIds = [...($(listElement).find(".tag.excluded:not(.actionable)").map((_, el) => $(el).attr("id")))];
|
const excludedTagIds = [...($(listElement).find(".tag.excluded:not(.actionable)").map((_, el) => $(el).attr("id")))];
|
||||||
$(CHARACTER_SELECTOR).each((_, element) => applyFilterToElement(tagIds, excludedTagIds, element));
|
$(characterSelector).each((_, element) => applyFilterToElement(tagIds, excludedTagIds, element));
|
||||||
updateVisibleDivs('#rm_print_characters_block', true);
|
updateVisibleDivs('#rm_print_characters_block', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +353,7 @@ function applyFilterToElement(tagIds, excludedTagIds, element) {
|
|||||||
|
|
||||||
function isElementTagged(element, tagId) {
|
function isElementTagged(element, tagId) {
|
||||||
const isGroup = $(element).hasClass('group_select');
|
const isGroup = $(element).hasClass('group_select');
|
||||||
const isCharacter = $(element).hasClass('character_select');
|
const isCharacter = $(element).hasClass('character_select') || $(element).hasClass('group_member');
|
||||||
const idAttr = isGroup ? 'grid' : 'chid';
|
const idAttr = isGroup ? 'grid' : 'chid';
|
||||||
const elementId = $(element).attr(idAttr);
|
const elementId = $(element).attr(idAttr);
|
||||||
const lookupValue = isCharacter ? characters[elementId].avatar : elementId;
|
const lookupValue = isCharacter ? characters[elementId].avatar : elementId;
|
||||||
@ -338,13 +361,13 @@ function isElementTagged(element, tagId) {
|
|||||||
return isTagged;
|
return isTagged;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearTagsFilter() {
|
function clearTagsFilter(characterSelector) {
|
||||||
$('#rm_tag_filter .tag').removeClass('selected');
|
$('.rm_tag_filter .tag').removeClass('selected');
|
||||||
$(CHARACTER_SELECTOR).removeClass('hiddenByTag');
|
$(characterSelector).removeClass('hiddenByTag');
|
||||||
}
|
}
|
||||||
|
|
||||||
function printTags() {
|
function printTagFilters(type = tag_filter_types.character) {
|
||||||
const FILTER_SELECTOR = '#rm_tag_filter';
|
const FILTER_SELECTOR = type === tag_filter_types.character ? CHARACTER_FILTER_SELECTOR : GROUP_FILTER_SELECTOR;
|
||||||
const selectedTagIds = [...($(FILTER_SELECTOR).find(".tag.selected").map((_, el) => $(el).attr("id")))];
|
const selectedTagIds = [...($(FILTER_SELECTOR).find(".tag.selected").map((_, el) => $(el).attr("id")))];
|
||||||
$(FILTER_SELECTOR).empty();
|
$(FILTER_SELECTOR).empty();
|
||||||
const characterTagIds = Object.values(tag_map).flat();
|
const characterTagIds = Object.values(tag_map).flat();
|
||||||
@ -378,7 +401,8 @@ function onTagRemoveClick(event) {
|
|||||||
removeTagFromMap(tagId);
|
removeTagFromMap(tagId);
|
||||||
$(`${getInlineListSelector()} .tag[id="${tagId}"]`).remove();
|
$(`${getInlineListSelector()} .tag[id="${tagId}"]`).remove();
|
||||||
|
|
||||||
printTags();
|
printTagFilters(tag_filter_types.character);
|
||||||
|
printTagFilters(tag_filter_types.group_member);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,6 +422,8 @@ function onCharacterCreateClick() {
|
|||||||
|
|
||||||
function onGroupCreateClick() {
|
function onGroupCreateClick() {
|
||||||
$("#groupTagList").empty();
|
$("#groupTagList").empty();
|
||||||
|
printTagFilters(tag_filter_types.character);
|
||||||
|
printTagFilters(tag_filter_types.group_member);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyTagsOnCharacterSelect() {
|
export function applyTagsOnCharacterSelect() {
|
||||||
@ -419,6 +445,8 @@ function applyTagsOnGroupSelect() {
|
|||||||
const tags = getTagsList(key);
|
const tags = getTagsList(key);
|
||||||
|
|
||||||
$("#groupTagList").empty();
|
$("#groupTagList").empty();
|
||||||
|
printTagFilters(tag_filter_types.character);
|
||||||
|
printTagFilters(tag_filter_types.group_member);
|
||||||
|
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
appendTagToList("#groupTagList", tag, { removable: true });
|
appendTagToList("#groupTagList", tag, { removable: true });
|
||||||
|
@ -2433,7 +2433,7 @@ input[type="range"]::-webkit-slider-thumb {
|
|||||||
.mes_buttons .mes_edit,
|
.mes_buttons .mes_edit,
|
||||||
.mes_buttons .mes_bookmark,
|
.mes_buttons .mes_bookmark,
|
||||||
.extraMesButtonsHint,
|
.extraMesButtonsHint,
|
||||||
#tagListHint,
|
.tagListHint,
|
||||||
.extraMesButtons div {
|
.extraMesButtons div {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: 0.3s ease-in-out;
|
transition: 0.3s ease-in-out;
|
||||||
@ -2444,7 +2444,7 @@ input[type="range"]::-webkit-slider-thumb {
|
|||||||
.mes_buttons .mes_edit:hover,
|
.mes_buttons .mes_edit:hover,
|
||||||
.mes_buttons .mes_bookmark:hover,
|
.mes_buttons .mes_bookmark:hover,
|
||||||
.extraMesButtonsHint:hover,
|
.extraMesButtonsHint:hover,
|
||||||
#tagListHint:hover,
|
.tagListHint:hover,
|
||||||
.extraMesButtons div:hover {
|
.extraMesButtons div:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
@ -2546,7 +2546,7 @@ input[type="range"]::-webkit-slider-thumb {
|
|||||||
|
|
||||||
#character_popup {
|
#character_popup {
|
||||||
display: none;
|
display: none;
|
||||||
background-color: var(--black30a);
|
background-color: var(--SmartThemeBlurTintColor);
|
||||||
backdrop-filter: blur(calc(var(--SmartThemeBlurStrength)*2));
|
backdrop-filter: blur(calc(var(--SmartThemeBlurStrength)*2));
|
||||||
-webkit-backdrop-filter: blur(calc(var(--SmartThemeBlurStrength)*2));
|
-webkit-backdrop-filter: blur(calc(var(--SmartThemeBlurStrength)*2));
|
||||||
|
|
||||||
@ -2838,10 +2838,13 @@ h5 {
|
|||||||
text-shadow: none !important;
|
text-shadow: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#rm_tag_filter .tag:not(.actionable) {
|
.rm_tag_filter .tag:not(.actionable) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#rm_group_chats_block .tag.filterByGroups {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.tag.actionable {
|
.tag.actionable {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@ -2855,7 +2858,7 @@ h5 {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tagListHint {
|
.tagListHint {
|
||||||
align-self: center;
|
align-self: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
@ -2927,7 +2930,7 @@ h5 {
|
|||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#rm_tag_filter .tag {
|
.rm_tag_filter .tag {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
filter: brightness(0.8);
|
filter: brightness(0.8);
|
||||||
@ -3151,15 +3154,17 @@ body .ui-widget-content li:hover {
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group_member .ch_name {
|
.group_member .group_member_name {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
width: calc(100% - 110px);
|
width: calc(100% - 110px);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
height: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group_member_icon .flex-container {
|
.group_member_icon .flex-container {
|
||||||
@ -4452,7 +4457,8 @@ body.waifuMode .zoomed_avatar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.world_entry_thin_controls,
|
.world_entry_thin_controls,
|
||||||
#persona-management-block {
|
#persona-management-block,
|
||||||
|
#character_popup .flex-container {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4935,4 +4941,4 @@ body.waifuMode .zoomed_avatar {
|
|||||||
background-color: var(--SmartThemeBlurTintColor);
|
background-color: var(--SmartThemeBlurTintColor);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 14px;
|
line-height: 14px;
|
||||||
}
|
}
|
||||||
|
@ -4025,7 +4025,7 @@ async function downloadChubCharacter(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const buffer = await result.buffer();
|
const buffer = await result.buffer();
|
||||||
const fileName = result.headers.get('content-disposition').split('filename=')[1];
|
const fileName = result.headers.get('content-disposition')?.split('filename=')[1] || `${sanitize(id)}.png`;
|
||||||
const fileType = result.headers.get('content-type');
|
const fileType = result.headers.get('content-type');
|
||||||
|
|
||||||
return { buffer, fileName, fileType };
|
return { buffer, fileName, fileType };
|
||||||
|
Reference in New Issue
Block a user