Invert groupId check
| @@ -2312,9 +2312,9 @@ async function generatePicture(initiator, args, trigger, message, callback) { | ||
| 2312 | 2312 | const quietPrompt = getQuietPrompt(generationType, trigger); |
| 2313 | 2313 | const context = getContext(); |
| 2314 | 2314 | |
| 2315 | - // if context.characterId is not null, then we get context.characters[context.characterId].avatar, else we get groupId and context.groups[groupId].id | |
| 2315 | + const characterName = context.groupId | |
| 2316 | - // sadly, groups is not an array, but is a dict with keys being index numbers, so we have to filter it | |
| 2316 | + ? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString() | |
| 2317 | - const characterName = context.characterId ? context.characters[context.characterId].name : context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString(); | |
| 2317 | + : context.characters[context.characterId]?.name; | |
| 2318 | 2318 | |
| 2319 | 2319 | if (generationType == generationMode.BACKGROUND) { |
| 2320 | 2320 | const callbackOriginal = callback; |
| @@ -3573,7 +3573,9 @@ async function sdMessageButton(e) { | ||
| 3573 | 3573 | const $mes = $icon.closest('.mes'); |
| 3574 | 3574 | const message_id = $mes.attr('mesid'); |
| 3575 | 3575 | const message = context.chat[message_id]; |
| 3576 | - const characterFileName = context.characterId ? context.characters[context.characterId].name : context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString(); | |
| 3576 | + const characterFileName = context.groupId | |
| 3577 | + ? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString() | |
| 3578 | + : context.characters[context.characterId]?.name; | |
| 3577 | 3579 | const messageText = message?.mes; |
| 3578 | 3580 | const hasSavedImage = message?.extra?.image && message?.extra?.title; |
| 3579 | 3581 | const hasSavedNegative = message?.extra?.negative; |
| @@ -3735,9 +3737,9 @@ async function onImageSwiped({ message, element, direction }) { | ||
| 3735 | 3737 | const hasNegative = message.extra.negative; |
| 3736 | 3738 | const prompt = await refinePrompt(message.extra.title, false, false); |
| 3737 | 3739 | const negativePromptPrefix = hasNegative ? await refinePrompt(message.extra.negative, false, true) : ''; |
| 3738 | 3740 | const characterName = context.characterIdgroupId |
| 3739 | - ? context.characters[context.characterId].name | |
| 3741 | + ? context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString() | |
| 3740 | - : context.groups[Object.keys(context.groups).filter(x => context.groups[x].id === context.groupId)[0]]?.id?.toString(); | |
| 3742 | + : context.characters[context.characterId]?.name; | |
| 3741 | 3743 | |
| 3742 | 3744 | messageImg.addClass(animationClass); |
| 3743 | 3745 | swipeControls.hide(); |