Merge branch 'staging' into qr-rewrite

This commit is contained in:
LenAnderson 2023-12-28 11:24:44 +00:00
commit 43d37b58db
2 changed files with 26 additions and 7 deletions

View File

@ -4130,6 +4130,7 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
if (messageBias) { if (messageBias) {
message.extra.bias = messageBias; message.extra.bias = messageBias;
message.mes = removeMacros(message.mes);
} }
await populateFileAttachment(message); await populateFileAttachment(message);

View File

@ -18,6 +18,8 @@ const defaultUrl = 'http://localhost:5100';
let saveMetadataTimeout = null; let saveMetadataTimeout = null;
let requiresReload = false;
export function saveMetadataDebounced() { export function saveMetadataDebounced() {
const context = getContext(); const context = getContext();
const groupId = context.groupId; const groupId = context.groupId;
@ -193,24 +195,32 @@ async function discoverExtensions() {
function onDisableExtensionClick() { function onDisableExtensionClick() {
const name = $(this).data('name'); const name = $(this).data('name');
disableExtension(name); disableExtension(name, false);
} }
function onEnableExtensionClick() { function onEnableExtensionClick() {
const name = $(this).data('name'); const name = $(this).data('name');
enableExtension(name); enableExtension(name, false);
} }
async function enableExtension(name) { async function enableExtension(name, reload = true) {
extension_settings.disabledExtensions = extension_settings.disabledExtensions.filter(x => x !== name); extension_settings.disabledExtensions = extension_settings.disabledExtensions.filter(x => x !== name);
await saveSettings(); await saveSettings();
if (reload) {
location.reload(); location.reload();
} else {
requiresReload = true;
}
} }
async function disableExtension(name) { async function disableExtension(name, reload = true) {
extension_settings.disabledExtensions.push(name); extension_settings.disabledExtensions.push(name);
await saveSettings(); await saveSettings();
if (reload) {
location.reload(); location.reload();
} else {
requiresReload = true;
}
} }
async function getManifests(names) { async function getManifests(names) {
@ -560,6 +570,7 @@ function getModuleInformation() {
* Generates the HTML strings for all extensions and displays them in a popup. * Generates the HTML strings for all extensions and displays them in a popup.
*/ */
async function showExtensionsDetails() { async function showExtensionsDetails() {
let popupPromise;
try { try {
showLoader(); showLoader();
let htmlDefault = '<h3>Built-in Extensions:</h3>'; let htmlDefault = '<h3>Built-in Extensions:</h3>';
@ -590,13 +601,20 @@ async function showExtensionsDetails() {
${htmlDefault} ${htmlDefault}
${htmlExternal} ${htmlExternal}
`; `;
callPopup(`<div class="extensions_info">${html}</div>`, 'text'); popupPromise = callPopup(`<div class="extensions_info">${html}</div>`, 'text');
} catch (error) { } catch (error) {
toastr.error('Error loading extensions. See browser console for details.'); toastr.error('Error loading extensions. See browser console for details.');
console.error(error); console.error(error);
} finally { } finally {
hideLoader(); hideLoader();
} }
if (popupPromise) {
await popupPromise;
}
if (requiresReload) {
showLoader();
location.reload();
}
} }