Allow reasoning edit to substitute macros on saving the reasoning (#5052) * Apply macro substitution when editing reasoning content - Added `substituteParams()` call to process macros in edited reasoning text - Changed `newReasoning` from const to let to allow reassignment * chore: Remove unnecessary double macro substitution from message edit - Removed `substituteParams()` call for first message (index 0) in `messageEditDone()` - Macro substitution is now handled consistently by `updateMessage()` for all messages

6f5032f20e9096c003fbb17055ce8e7737c2b7a0

Wolfsblvt <wolfsblvt@gmail.com>

Signed
2 files changed, +2 -4Showing whitespace changes
public/script.js+0 -3
@@ -8158,9 +8158,6 @@ async function messageEditDone(div) {
8158 }8158 }
81598159
8160 let { mesBlock, text, mes, bias } = updateMessage(div);8160 let { mesBlock, text, mes, bias } = updateMessage(div);
8161 if (this_edit_mes_id == 0) {
8162 text = substituteParams(text);
8163 }
81648161
8165 await eventSource.emit(event_types.MESSAGE_EDITED, this_edit_mes_id);8162 await eventSource.emit(event_types.MESSAGE_EDITED, this_edit_mes_id);
8166 text = chat[this_edit_mes_id]?.mes ?? text;8163 text = chat[this_edit_mes_id]?.mes ?? text;
public/scripts/reasoning.js+2 -1
@@ -1163,7 +1163,8 @@ function setReasoningEventHandlers() {
1163 }1163 }
11641164
1165 const textarea = messageBlock.find('.reasoning_edit_textarea');1165 const textarea = messageBlock.find('.reasoning_edit_textarea');
1166 const newReasoning = String(textarea.val());1166 let newReasoning = String(textarea.val());
1167 newReasoning = substituteParams(newReasoning);
1167 textarea.remove();1168 textarea.remove();
1168 if (newReasoning === message.extra.reasoning) {1169 if (newReasoning === message.extra.reasoning) {
1169 return;1170 return;