mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-10 00:50:43 +01:00
Merge branch 'staging' into vectors
This commit is contained in:
commit
42fd317188
@ -5408,17 +5408,18 @@ function select_rm_info(type, charId, previousCharId = null) {
|
|||||||
$('#rm_print_characters_pagination').pagination('go', page);
|
$('#rm_print_characters_pagination').pagination('go', page);
|
||||||
|
|
||||||
waitUntilCondition(() => document.querySelector(selector) !== null).then(() => {
|
waitUntilCondition(() => document.querySelector(selector) !== null).then(() => {
|
||||||
const element = $(selector).parent().get(0);
|
const parent = $('#rm_print_characters_block');
|
||||||
|
const element = $(selector).parent();
|
||||||
|
|
||||||
if (!element) {
|
if (element.length === 0) {
|
||||||
console.log(`Could not find element for character ${charId}`);
|
console.log(`Could not find element for character ${charId}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
parent.scrollTop(element.position().top + parent.scrollTop());
|
||||||
$(element).addClass('flash animated');
|
element.addClass('flash animated');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$(element).removeClass('flash animated');
|
element.removeClass('flash animated');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -5427,16 +5428,29 @@ function select_rm_info(type, charId, previousCharId = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'group_create') {
|
if (type === 'group_create') {
|
||||||
//for groups, ${charId} = data.id from group-chats.js createGroup()
|
// Find the page at which the character is located
|
||||||
const element = $(`#rm_characters_block [grid="${charId}"]`).get(0);
|
const charData = getEntitiesList({ doFilter: true });
|
||||||
element.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
const charIndex = charData.findIndex((x) => String(x?.item?.id) === String(charId));
|
||||||
|
|
||||||
|
if (charIndex === -1) {
|
||||||
|
console.log(`Could not find group ${charId} in the list`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const perPage = Number(localStorage.getItem('Characters_PerPage'));
|
||||||
|
const page = Math.floor(charIndex / perPage) + 1;
|
||||||
|
$('#rm_print_characters_pagination').pagination('go', page);
|
||||||
|
const parent = $('#rm_print_characters_block');
|
||||||
|
const selector = `#rm_print_characters_block [grid="${charId}"]`;
|
||||||
try {
|
try {
|
||||||
if (element !== undefined || element !== null) {
|
waitUntilCondition(() => document.querySelector(selector) !== null).then(() => {
|
||||||
|
const element = $(selector);
|
||||||
|
parent.scrollTop(element.position().top + parent.scrollTop());
|
||||||
$(element).addClass('flash animated');
|
$(element).addClass('flash animated');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$(element).removeClass('flash animated');
|
$(element).removeClass('flash animated');
|
||||||
}, 5000);
|
}, 5000);
|
||||||
} else { console.log('didnt find the element'); }
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@ import {
|
|||||||
import { selected_group } from "../../group-chats.js";
|
import { selected_group } from "../../group-chats.js";
|
||||||
import { loadFileToDocument } from "../../utils.js";
|
import { loadFileToDocument } from "../../utils.js";
|
||||||
import { loadMovingUIState } from '../../power-user.js';
|
import { loadMovingUIState } from '../../power-user.js';
|
||||||
import { dragElement } from '../../RossAscends-mods.js'
|
import { dragElement } from '../../RossAscends-mods.js';
|
||||||
|
import { registerSlashCommand } from "../../slash-commands.js";
|
||||||
|
|
||||||
const extensionName = "gallery";
|
const extensionName = "gallery";
|
||||||
const extensionFolderPath = `scripts/extensions/${extensionName}/`;
|
const extensionFolderPath = `scripts/extensions/${extensionName}/`;
|
||||||
@ -386,3 +387,10 @@ function viewWithDragbox(items) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Registers a simple command for opening the char gallery.
|
||||||
|
registerSlashCommand("show-gallery", showGalleryCommand, ["sg"], "Shows the gallery", true, true);
|
||||||
|
|
||||||
|
function showGalleryCommand(args) {
|
||||||
|
showCharGallery();
|
||||||
|
}
|
||||||
|
@ -99,7 +99,14 @@ async function onQuickReplyEnabledInput() {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New function to handle input on quickActionEnabled
|
||||||
|
async function onQuickActionEnabledInput() {
|
||||||
|
extension_settings.quickReply.quickActionEnabled = $(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
}
|
||||||
|
|
||||||
async function sendQuickReply(index) {
|
async function sendQuickReply(index) {
|
||||||
|
const existingText = $("#send_textarea").val();
|
||||||
const prompt = extension_settings.quickReply.quickReplySlots[index]?.mes || '';
|
const prompt = extension_settings.quickReply.quickReplySlots[index]?.mes || '';
|
||||||
|
|
||||||
if (!prompt) {
|
if (!prompt) {
|
||||||
@ -107,10 +114,29 @@ async function sendQuickReply(index) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#send_textarea").val(prompt);
|
let newText;
|
||||||
$("#send_but").trigger('click');
|
|
||||||
|
if (existingText) {
|
||||||
|
// If existing text, add space after prompt
|
||||||
|
newText = existingText + ' ' + prompt + ' ';
|
||||||
|
} else {
|
||||||
|
// If no existing text, add prompt only (with a trailing space)
|
||||||
|
newText = prompt + ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#send_textarea").val(newText);
|
||||||
|
|
||||||
|
// Set the focus back to the textarea
|
||||||
|
$("#send_textarea").focus();
|
||||||
|
|
||||||
|
// Only trigger send button if quickActionEnabled is not checked or
|
||||||
|
// the prompt starts with '/'
|
||||||
|
if (!$("#quickActionEnabled").prop('checked') || prompt.startsWith('/')) {
|
||||||
|
$("#send_but").trigger('click');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function addQuickReplyBar() {
|
function addQuickReplyBar() {
|
||||||
$('#quickReplyBar').remove();
|
$('#quickReplyBar').remove();
|
||||||
let quickReplyButtonHtml = '';
|
let quickReplyButtonHtml = '';
|
||||||
@ -309,6 +335,10 @@ jQuery(async () => {
|
|||||||
<input id="quickReplyEnabled" type="checkbox" />
|
<input id="quickReplyEnabled" type="checkbox" />
|
||||||
Enable Quick Replies
|
Enable Quick Replies
|
||||||
</label>
|
</label>
|
||||||
|
<label class="checkbox_label marginBot10 wide100p flexnowrap">
|
||||||
|
<input id="quickActionEnabled" type="checkbox" />
|
||||||
|
Disable Send / Insert In User Input
|
||||||
|
</label>
|
||||||
<div class="flex-container flexnowrap wide100p">
|
<div class="flex-container flexnowrap wide100p">
|
||||||
<select id="quickReplyPresets" name="quickreply-preset">
|
<select id="quickReplyPresets" name="quickreply-preset">
|
||||||
</select>
|
</select>
|
||||||
@ -330,7 +360,9 @@ jQuery(async () => {
|
|||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
$('#extensions_settings2').append(settingsHtml);
|
$('#extensions_settings2').append(settingsHtml);
|
||||||
|
|
||||||
|
// Add event handler for quickActionEnabled
|
||||||
|
$('#quickActionEnabled').on('input', onQuickActionEnabledInput);
|
||||||
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
$('#quickReplyEnabled').on('input', onQuickReplyEnabledInput);
|
||||||
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
$('#quickReplyNumberOfSlotsApply').on('click', onQuickReplyNumberOfSlotsInput);
|
||||||
$("#quickReplyPresetSaveButton").on('click', saveQuickReplyPreset);
|
$("#quickReplyPresetSaveButton").on('click', saveQuickReplyPreset);
|
||||||
|
@ -582,10 +582,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
|||||||
typingIndicator
|
typingIndicator
|
||||||
.find(".typing_indicator_name")
|
.find(".typing_indicator_name")
|
||||||
.text(characters[chId].name);
|
.text(characters[chId].name);
|
||||||
$("#chat").append(typingIndicator);
|
typingIndicator.show();
|
||||||
typingIndicator.show(200, function () {
|
|
||||||
typingIndicator.get(0).scrollIntoView({ behavior: "smooth" });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is awful. Refactor this
|
// TODO: This is awful. Refactor this
|
||||||
@ -681,9 +678,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// hide and reapply the indicator to the bottom of the list
|
typingIndicator.hide();
|
||||||
typingIndicator.hide(200);
|
|
||||||
$("#chat").append(typingIndicator);
|
|
||||||
|
|
||||||
is_group_generating = false;
|
is_group_generating = false;
|
||||||
$("#send_textarea").attr("disabled", false);
|
$("#send_textarea").attr("disabled", false);
|
||||||
@ -1109,6 +1104,7 @@ function select_group_chats(groupId, skipAnimation) {
|
|||||||
$("#rm_group_restore_avatar").toggle(!!group && isValidImageUrl(group.avatar_url));
|
$("#rm_group_restore_avatar").toggle(!!group && isValidImageUrl(group.avatar_url));
|
||||||
$("#rm_group_filter").val("").trigger("input");
|
$("#rm_group_filter").val("").trigger("input");
|
||||||
$(`input[name="rm_group_activation_strategy"][value="${replyStrategy}"]`).prop('checked', true);
|
$(`input[name="rm_group_activation_strategy"][value="${replyStrategy}"]`).prop('checked', true);
|
||||||
|
$("#rm_group_chat_name").val(groupName);
|
||||||
|
|
||||||
if (!skipAnimation) {
|
if (!skipAnimation) {
|
||||||
selectRightMenuWithAnimation('rm_group_chats_block');
|
selectRightMenuWithAnimation('rm_group_chats_block');
|
||||||
|
@ -2768,6 +2768,7 @@ body .ui-widget-content li:hover {
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
opacity: 0.85;
|
opacity: 0.85;
|
||||||
text-shadow: 0px 0px calc(var(--shadowWidth) * 1px) var(--SmartThemeShadowColor);
|
text-shadow: 0px 0px calc(var(--shadowWidth) * 1px) var(--SmartThemeShadowColor);
|
||||||
|
order: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.typing_indicator:after {
|
.typing_indicator:after {
|
||||||
@ -3608,4 +3609,4 @@ a {
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2785,6 +2785,7 @@ app.post('/getgroups', jsonParser, (_, response) => {
|
|||||||
const group = json5.parse(fileContents);
|
const group = json5.parse(fileContents);
|
||||||
const groupStat = fs.statSync(filePath);
|
const groupStat = fs.statSync(filePath);
|
||||||
group['date_added'] = groupStat.birthtimeMs;
|
group['date_added'] = groupStat.birthtimeMs;
|
||||||
|
group['create_date'] = humanizedISO8601DateTime(groupStat.birthtimeMs);
|
||||||
|
|
||||||
let chat_size = 0;
|
let chat_size = 0;
|
||||||
let date_last_chat = 0;
|
let date_last_chat = 0;
|
||||||
@ -4005,8 +4006,10 @@ app.post("/tokenize_via_api", jsonParser, async function (request, response) {
|
|||||||
headers: { "Content-Type": "application/json" }
|
headers: { "Content-Type": "application/json" }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (main_api == 'textgenerationwebui' && request.body.use_mancer) {
|
if (main_api == 'textgenerationwebui') {
|
||||||
args.headers = Object.assign(args.headers, get_mancer_headers());
|
if (request.body.use_mancer) {
|
||||||
|
args.headers = Object.assign(args.headers, get_mancer_headers());
|
||||||
|
}
|
||||||
const data = await postAsync(api_server + "/v1/token-count", args);
|
const data = await postAsync(api_server + "/v1/token-count", args);
|
||||||
return response.send({ count: data['results'][0]['tokens'] });
|
return response.send({ count: data['results'][0]['tokens'] });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user