Add updateMessageBlock and appendMediaToMessage to getContext

9d73189133d20aa94e12ed3512243945caa54d77

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +9 -0Ignore whitespace
public/script.js+5 -0
@@ -2240,6 +2240,11 @@ function getMessageFromTemplate({
22402240 return mes;
22412241}
22422242
2243+/**
2244+ * Re-renders a message block with updated content.
2245+ * @param {number} messageId Message ID
2246+ * @param {object} message Message object
2247+ */
22432248export function updateMessageBlock(messageId, message) {
22442249 const messageElement = $(`#chat [mesid="${messageId}"]`);
22452250 const text = message?.extra?.display_text ?? message.mes;
public/scripts/st-context.js+4 -0
@@ -1,6 +1,7 @@
11import {
22 activateSendButtons,
33 addOneMessage,
4+ appendMediaToMessage,
45 callPopup,
56 characters,
67 chat,
@@ -41,6 +42,7 @@ import {
4142 substituteParamsExtended,
4243 this_chid,
4344 updateChatMetadata,
45+ updateMessageBlock,
4446} from '../script.js';
4547import {
4648 extension_settings,
@@ -171,6 +173,8 @@ export function getContext() {
171173 getCharacters,
172174 uuidv4,
173175 humanizedDateTime,
176+ updateMessageBlock,
177+ appendMediaToMessage,
174178 };
175179}
176180