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
Signed| @@ -8158,9 +8158,6 @@ async function messageEditDone(div) { | ||
| 8158 | 8158 | } |
| 8159 | 8159 | |
| 8160 | 8160 | let { mesBlock, text, mes, bias } = updateMessage(div); |
| 8161 | - if (this_edit_mes_id == 0) { | |
| 8162 | - text = substituteParams(text); | |
| 8163 | - } | |
| 8164 | 8161 | |
| 8165 | 8162 | await eventSource.emit(event_types.MESSAGE_EDITED, this_edit_mes_id); |
| 8166 | 8163 | text = chat[this_edit_mes_id]?.mes ?? text; |
| @@ -1163,7 +1163,8 @@ function setReasoningEventHandlers() { | ||
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | const textarea = messageBlock.find('.reasoning_edit_textarea'); |
| 1166 | 1166 | constlet newReasoning = String(textarea.val()); |
| 1167 | + newReasoning = substituteParams(newReasoning); | |
| 1167 | 1168 | textarea.remove(); |
| 1168 | 1169 | if (newReasoning === message.extra.reasoning) { |
| 1169 | 1170 | return; |