mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix message trigger on disabled character in amalgamate group mode
This commit is contained in:
@@ -2553,7 +2553,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selected_group) {
|
if (selected_group) {
|
||||||
const groupCards = getGroupCharacterCards(selected_group);
|
const groupCards = getGroupCharacterCards(selected_group, Number(this_chid));
|
||||||
|
|
||||||
if (groupCards) {
|
if (groupCards) {
|
||||||
charDescription = groupCards.description;
|
charDescription = groupCards.description;
|
||||||
@@ -2565,7 +2565,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
|
|
||||||
// Depth prompt (character-specific A/N)
|
// Depth prompt (character-specific A/N)
|
||||||
removeDepthPrompts();
|
removeDepthPrompts();
|
||||||
const groupDepthPrompts = getGroupDepthPrompts(selected_group);
|
const groupDepthPrompts = getGroupDepthPrompts(selected_group, Number(this_chid));
|
||||||
|
|
||||||
if (selected_group && Array.isArray(groupDepthPrompts) && groupDepthPrompts.length > 0) {
|
if (selected_group && Array.isArray(groupDepthPrompts) && groupDepthPrompts.length > 0) {
|
||||||
groupDepthPrompts.forEach((value, index) => {
|
groupDepthPrompts.forEach((value, index) => {
|
||||||
|
@@ -203,9 +203,10 @@ export async function getGroupChat(groupId) {
|
|||||||
/**
|
/**
|
||||||
* Gets depth prompts for group members.
|
* Gets depth prompts for group members.
|
||||||
* @param {string} groupId Group ID
|
* @param {string} groupId Group ID
|
||||||
|
* @param {number} characterId Current Character ID
|
||||||
* @returns {{depth: number, text: string}[]} Array of depth prompts
|
* @returns {{depth: number, text: string}[]} Array of depth prompts
|
||||||
*/
|
*/
|
||||||
export function getGroupDepthPrompts(groupId) {
|
export function getGroupDepthPrompts(groupId, characterId) {
|
||||||
if (!groupId) {
|
if (!groupId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -224,15 +225,16 @@ export function getGroupDepthPrompts(groupId) {
|
|||||||
const depthPrompts = [];
|
const depthPrompts = [];
|
||||||
|
|
||||||
for (const member of group.members) {
|
for (const member of group.members) {
|
||||||
if (group.disabled_members.includes(member)) {
|
const index = characters.findIndex(x => x.avatar === member);
|
||||||
console.debug(`Skipping disabled group member: ${member}`);
|
const character = characters[index];
|
||||||
|
|
||||||
|
if (index === -1 || !character) {
|
||||||
|
console.debug(`Skipping missing member: ${member}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const character = characters.find(x => x.avatar === member);
|
if (group.disabled_members.includes(member) && characterId !== index) {
|
||||||
|
console.debug(`Skipping disabled group member: ${member}`);
|
||||||
if (!character) {
|
|
||||||
console.debug(`Skipping missing member: ${member}`);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,9 +252,10 @@ export function getGroupDepthPrompts(groupId) {
|
|||||||
/**
|
/**
|
||||||
* Combines group members info a single string. Only for groups with generation mode set to APPEND.
|
* Combines group members info a single string. Only for groups with generation mode set to APPEND.
|
||||||
* @param {string} groupId Group ID
|
* @param {string} groupId Group ID
|
||||||
|
* @param {number} characterId Current Character ID
|
||||||
* @returns {{description: string, personality: string, scenario: string, mesExample: string}} Group character cards combined
|
* @returns {{description: string, personality: string, scenario: string, mesExample: string}} Group character cards combined
|
||||||
*/
|
*/
|
||||||
export function getGroupCharacterCards(groupId) {
|
export function getGroupCharacterCards(groupId, characterId) {
|
||||||
console.debug('getGroupCharacterCards entered for group: ', groupId);
|
console.debug('getGroupCharacterCards entered for group: ', groupId);
|
||||||
const group = groups.find(x => x.id === groupId);
|
const group = groups.find(x => x.id === groupId);
|
||||||
|
|
||||||
@@ -268,15 +271,16 @@ export function getGroupCharacterCards(groupId) {
|
|||||||
let mesExamples = [];
|
let mesExamples = [];
|
||||||
|
|
||||||
for (const member of group.members) {
|
for (const member of group.members) {
|
||||||
if (group.disabled_members.includes(member)) {
|
const index = characters.findIndex(x => x.avatar === member);
|
||||||
console.debug(`Skipping disabled group member: ${member}`);
|
const character = characters[index];
|
||||||
|
|
||||||
|
if (index === -1 || !character) {
|
||||||
|
console.debug(`Skipping missing member: ${member}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const character = characters.find(x => x.avatar === member);
|
if (group.disabled_members.includes(member) && characterId !== index) {
|
||||||
|
console.debug(`Skipping disabled group member: ${member}`);
|
||||||
if (!character) {
|
|
||||||
console.debug(`Skipping missing member: ${member}`);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user