mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add fallback mechanism for background selection in autoBackgroundCommand
This commit is contained in:
@@ -333,6 +333,14 @@ async function autoBackgroundCommand() {
|
|||||||
const bestMatch = fuse.search(reply, { limit: 1 });
|
const bestMatch = fuse.search(reply, { limit: 1 });
|
||||||
|
|
||||||
if (bestMatch.length == 0) {
|
if (bestMatch.length == 0) {
|
||||||
|
for (const option of options) {
|
||||||
|
if (String(reply).toLowerCase().includes(option.text.toLowerCase())) {
|
||||||
|
console.debug('Fallback choosing background:', option);
|
||||||
|
option.element.click();
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toastr.warning('No match found. Please try again.');
|
toastr.warning('No match found. Please try again.');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user