Add updateMessageBlock and appendMediaToMessage to getContext

This commit is contained in:
Cohee
2025-01-25 00:38:13 +02:00
parent 536d4218c2
commit 9d73189133
2 changed files with 9 additions and 0 deletions

View File

@ -2240,6 +2240,11 @@ function getMessageFromTemplate({
return mes;
}
/**
* Re-renders a message block with updated content.
* @param {number} messageId Message ID
* @param {object} message Message object
*/
export function updateMessageBlock(messageId, message) {
const messageElement = $(`#chat [mesid="${messageId}"]`);
const text = message?.extra?.display_text ?? message.mes;

View File

@ -1,6 +1,7 @@
import {
activateSendButtons,
addOneMessage,
appendMediaToMessage,
callPopup,
characters,
chat,
@ -41,6 +42,7 @@ import {
substituteParamsExtended,
this_chid,
updateChatMetadata,
updateMessageBlock,
} from '../script.js';
import {
extension_settings,
@ -171,6 +173,8 @@ export function getContext() {
getCharacters,
uuidv4,
humanizedDateTime,
updateMessageBlock,
appendMediaToMessage,
};
}