mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
#930 Fix WI activation via slash command
This commit is contained in:
@@ -1331,7 +1331,6 @@ export async function importEmbeddedWorldInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onWorldInfoChange(_, text) {
|
function onWorldInfoChange(_, text) {
|
||||||
let selectedWorlds;
|
|
||||||
if (_ !== '__notSlashCommand__') { // if it's a slash command
|
if (_ !== '__notSlashCommand__') { // if it's a slash command
|
||||||
if (text !== undefined) { // and args are provided
|
if (text !== undefined) { // and args are provided
|
||||||
const slashInputSplitText = text.trim().toLowerCase().split(",");
|
const slashInputSplitText = text.trim().toLowerCase().split(",");
|
||||||
@@ -1339,12 +1338,14 @@ function onWorldInfoChange(_, text) {
|
|||||||
slashInputSplitText.forEach((worldName) => {
|
slashInputSplitText.forEach((worldName) => {
|
||||||
const wiElement = getWIElement(worldName);
|
const wiElement = getWIElement(worldName);
|
||||||
if (wiElement.length > 0) {
|
if (wiElement.length > 0) {
|
||||||
|
selected_world_info.push(wiElement.text());
|
||||||
wiElement.prop("selected", true);
|
wiElement.prop("selected", true);
|
||||||
toastr.success(`Activated world: ${wiElement.text()}`);
|
toastr.success(`Activated world: ${wiElement.text()}`);
|
||||||
} else {
|
} else {
|
||||||
toastr.error(`No world found named: ${worldName}`);
|
toastr.error(`No world found named: ${worldName}`);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
$("#world_info").trigger("change");
|
||||||
} else { // if no args, unset all worlds
|
} else { // if no args, unset all worlds
|
||||||
toastr.success('Deactivated all worlds');
|
toastr.success('Deactivated all worlds');
|
||||||
selected_world_info = [];
|
selected_world_info = [];
|
||||||
|
Reference in New Issue
Block a user