Clean-up SD message sending

This commit is contained in:
Cohee
2024-05-21 15:03:57 +03:00
parent 630b72f13a
commit 226852233f

View File

@ -31,9 +31,6 @@ import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '
import { resolveVariable } from '../../variables.js'; import { resolveVariable } from '../../variables.js';
export { MODULE_NAME }; export { MODULE_NAME };
// Wraps a string into paragraph block
const p = a => `<p>${a}</p>`;
const MODULE_NAME = 'sd'; const MODULE_NAME = 'sd';
const UPDATE_INTERVAL = 1000; const UPDATE_INTERVAL = 1000;
// This is a 1x1 transparent PNG // This is a 1x1 transparent PNG
@ -2840,18 +2837,20 @@ async function onComfyDeleteWorkflowClick() {
*/ */
async function sendMessage(prompt, image, generationType, additionalNegativePrefix) { async function sendMessage(prompt, image, generationType, additionalNegativePrefix) {
const context = getContext(); const context = getContext();
const messageText = `[${context.name2} sends a picture that contains: ${prompt}]`; const name = context.groupId ? systemUserName : context.name2;
const messageText = `[${name} sends a picture that contains: ${prompt}]`;
const message = { const message = {
name: context.groupId ? systemUserName : context.name2, name: name,
is_user: false, is_user: false,
is_system: true, is_system: true,
send_date: getMessageTimeStamp(), send_date: getMessageTimeStamp(),
mes: context.groupId ? p(messageText) : messageText, mes: messageText,
extra: { extra: {
image: image, image: image,
title: prompt, title: prompt,
generationType: generationType, generationType: generationType,
negative: additionalNegativePrefix, negative: additionalNegativePrefix,
inline_image: false,
}, },
}; };
context.chat.push(message); context.chat.push(message);