mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Filter system messages from raw last SD gens
This commit is contained in:
@ -539,8 +539,21 @@ function processReply(str) {
|
|||||||
|
|
||||||
|
|
||||||
function getRawLastMessage() {
|
function getRawLastMessage() {
|
||||||
|
const getLastUsableMessage = () => {
|
||||||
|
for (const message of context.chat.slice().reverse()) {
|
||||||
|
if (message.is_system) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return message.mes;
|
||||||
|
}
|
||||||
|
|
||||||
|
toastr.warning('No usable messages found.', 'Stable Diffusion');
|
||||||
|
throw new Error('No usable messages found.');
|
||||||
|
}
|
||||||
|
|
||||||
const context = getContext();
|
const context = getContext();
|
||||||
const lastMessage = context.chat.slice(-1)[0].mes,
|
const lastMessage = getLastUsableMessage(),
|
||||||
characterDescription = context.characters[context.characterId].description,
|
characterDescription = context.characters[context.characterId].description,
|
||||||
situation = context.characters[context.characterId].scenario;
|
situation = context.characters[context.characterId].scenario;
|
||||||
return `((${processReply(lastMessage)})), (${processReply(situation)}:0.7), (${processReply(characterDescription)}:0.5)`
|
return `((${processReply(lastMessage)})), (${processReply(situation)}:0.7), (${processReply(characterDescription)}:0.5)`
|
||||||
|
Reference in New Issue
Block a user