mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Less discrete embedded lorebook prompt
This commit is contained in:
@@ -1578,12 +1578,19 @@ export function checkEmbeddedWorld(chid) {
|
|||||||
const checkKey = `AlertWI_${characters[chid].avatar}`;
|
const checkKey = `AlertWI_${characters[chid].avatar}`;
|
||||||
const worldName = characters[chid]?.data?.extensions?.world;
|
const worldName = characters[chid]?.data?.extensions?.world;
|
||||||
if (!localStorage.getItem(checkKey) && (!worldName || !world_names.includes(worldName))) {
|
if (!localStorage.getItem(checkKey) && (!worldName || !world_names.includes(worldName))) {
|
||||||
toastr.info(
|
|
||||||
'To import and use it, select "Import Card Lore" in the "More..." dropdown menu on the character panel.',
|
|
||||||
`${characters[chid].name} has an embedded World/Lorebook`,
|
|
||||||
{ timeOut: 10000, extendedTimeOut: 20000, positionClass: 'toast-top-center' },
|
|
||||||
);
|
|
||||||
localStorage.setItem(checkKey, 1);
|
localStorage.setItem(checkKey, 1);
|
||||||
|
|
||||||
|
callPopup(`<h3>This character has an embedded World/Lorebook.</h3>
|
||||||
|
<h3>Would you like to import it now?</h3>
|
||||||
|
<div class="m-b-1">If you want to import it later, select "Import Card Lore" in the "More..." dropdown menu on the character panel.</div>`,
|
||||||
|
'confirm',
|
||||||
|
'',
|
||||||
|
{ okButton: 'Yes', })
|
||||||
|
.then((result) => {
|
||||||
|
if (result) {
|
||||||
|
importEmbeddedWorldInfo(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1591,7 +1598,7 @@ export function checkEmbeddedWorld(chid) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function importEmbeddedWorldInfo() {
|
export async function importEmbeddedWorldInfo(skipPopup = false) {
|
||||||
const chid = $('#import_character_info').data('chid');
|
const chid = $('#import_character_info').data('chid');
|
||||||
|
|
||||||
if (chid === undefined) {
|
if (chid === undefined) {
|
||||||
@@ -1601,10 +1608,12 @@ export async function importEmbeddedWorldInfo() {
|
|||||||
const bookName = characters[chid]?.data?.character_book?.name || `${characters[chid]?.name}'s Lorebook`;
|
const bookName = characters[chid]?.data?.character_book?.name || `${characters[chid]?.name}'s Lorebook`;
|
||||||
const confirmationText = (`<h3>Are you sure you want to import "${bookName}"?</h3>`) + (world_names.includes(bookName) ? 'It will overwrite the World/Lorebook with the same name.' : '');
|
const confirmationText = (`<h3>Are you sure you want to import "${bookName}"?</h3>`) + (world_names.includes(bookName) ? 'It will overwrite the World/Lorebook with the same name.' : '');
|
||||||
|
|
||||||
const confirmation = await callPopup(confirmationText, 'confirm');
|
if (!skipPopup) {
|
||||||
|
const confirmation = await callPopup(confirmationText, 'confirm');
|
||||||
|
|
||||||
if (!confirmation) {
|
if (!confirmation) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const convertedBook = convertCharacterBook(characters[chid].data.character_book);
|
const convertedBook = convertCharacterBook(characters[chid].data.character_book);
|
||||||
|
Reference in New Issue
Block a user