Modify when "Add reasoning" button shows up
| @@ -2257,6 +2257,9 @@ function getMessageFromTemplate({ | ||
| 2257 | 2257 | timerValue && mes.find('.mes_timer').attr('title', timerTitle).text(timerValue); |
| 2258 | 2258 | bookmarkLink && updateBookmarkDisplay(mes); |
| 2259 | 2259 | |
| 2260 | + if (reasoning) { | |
| 2261 | + mes.addClass('reasoning'); | |
| 2262 | + } | |
| 2260 | 2263 | if (reasoningDuration) { |
| 2261 | 2264 | updateReasoningTimeUI(mes.find('.mes_reasoning_header_title')[0], reasoningDuration, { forceEnd: true }); |
| 2262 | 2265 | } |
| @@ -2278,6 +2281,7 @@ export function updateMessageBlock(messageId, message) { | ||
| 2278 | 2281 | const text = message?.extra?.display_text ?? message.mes; |
| 2279 | 2282 | messageElement.find('.mes_text').html(messageFormatting(text, message.name, message.is_system, message.is_user, messageId, {}, false)); |
| 2280 | 2283 | messageElement.find('.mes_reasoning').html(messageFormatting(message.extra?.reasoning ?? '', '', false, false, messageId, {}, true)); |
| 2284 | + messageElement.toggleClass('reasoning', !!message.extra?.reasoning); | |
| 2281 | 2285 | addCopyToCodeBlocks(messageElement); |
| 2282 | 2286 | appendMediaToMessage(message, messageElement); |
| 2283 | 2287 | } |
| @@ -3262,6 +3266,9 @@ class StreamingProcessor { | ||
| 3262 | 3266 | if (this.messageReasoningDom instanceof HTMLElement) { |
| 3263 | 3267 | const formattedReasoning = messageFormatting(this.reasoning, '', false, false, messageId, {}, true); |
| 3264 | 3268 | this.messageReasoningDom.innerHTML = formattedReasoning; |
| 3269 | + if (this.reasoning) { | |
| 3270 | + this.messageDom.classList.add('reasoning'); | |
| 3271 | + } | |
| 3265 | 3272 | } |
| 3266 | 3273 | } |
| 3267 | 3274 | |
| @@ -10862,6 +10869,18 @@ jQuery(async function () { | ||
| 10862 | 10869 | } |
| 10863 | 10870 | }); |
| 10864 | 10871 | |
| 10872 | + $(document).on('click', '.mes_reasoning_header', function () { | |
| 10873 | + // If we are in message edit mode and reasoning area is closed, a click opens and edits it | |
| 10874 | + const mes = $(this).closest('.mes'); | |
| 10875 | + const mesEditArea = mes.find('#curEditTextarea'); | |
| 10876 | + if (mesEditArea.length) { | |
| 10877 | + const summary = $(mes).find('.mes_reasoning_summary'); | |
| 10878 | + if (!summary.attr('open')) { | |
| 10879 | + summary.find('.mes_reasoning_edit').trigger('click'); | |
| 10880 | + } | |
| 10881 | + } | |
| 10882 | + }); | |
| 10883 | + | |
| 10865 | 10884 | $(document).on('input', '#curEditTextarea', function () { |
| 10866 | 10885 | if (power_user.auto_save_msg_edits === true) { |
| 10867 | 10886 | messageEditAuto($(this)); |
| @@ -11421,6 +11440,12 @@ jQuery(async function () { | ||
| 11421 | 11440 | $(this).closest('.mes').find('.mes_reasoning_edit_cancel:visible').trigger('click'); |
| 11422 | 11441 | }); |
| 11423 | 11442 | |
| 11443 | + $(document).on('click', '.mes_reasoning_details', function (e) { | |
| 11444 | + if (!e.target.closest('.mes_reasoning_actions') && !e.target.closest('.mes_reasoning_header')) { | |
| 11445 | + e.preventDefault(); | |
| 11446 | + } | |
| 11447 | + }); | |
| 11448 | + | |
| 11424 | 11449 | $(document).keyup(function (e) { |
| 11425 | 11450 | if (e.key === 'Escape') { |
| 11426 | 11451 | const isEditVisible = $('#curEditTextarea').is(':visible') || $('.reasoning_edit_textarea').length > 0; |
| @@ -1129,14 +1129,10 @@ body .panelControlBar { | ||
| 1129 | 1129 | /*only affects bubblechat to make it sit nicely at the bottom*/ |
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | 1132 | .last_mes:has(.mes_text:empty):has(.mes_reasoning_details[open]) .mes_reasoning:not(:empty) { |
| 1133 | 1133 | margin-bottom: var(--mes-right-spacing); |
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | -.last_mes .mes_text { | |
| 1137 | - padding-right: var(--mes-right-spacing); | |
| 1138 | -} | |
| 1139 | - | |
| 1140 | 1136 | /* SWIPE RELATED STYLES*/ |
| 1141 | 1137 | |
| 1142 | 1138 | .mes { |
| @@ -1358,6 +1354,7 @@ body.swipeAllMessages .mes:not(.last_mes) .swipes-counter { | ||
| 1358 | 1354 | padding-left: 0; |
| 1359 | 1355 | padding-top: 5px; |
| 1360 | 1356 | padding-bottom: 5px; |
| 1357 | + padding-right: var(--mes-right-spacing); | |
| 1361 | 1358 | } |
| 1362 | 1359 | |
| 1363 | 1360 | br { |
| @@ -4252,6 +4249,11 @@ input[type="range"]::-webkit-slider-thumb { | ||
| 4252 | 4249 | transition: 0.3s ease-in-out; |
| 4253 | 4250 | } |
| 4254 | 4251 | |
| 4252 | +.mes_reasoning_actions { | |
| 4253 | + margin: 0; | |
| 4254 | + margin-top: 0.5rem; | |
| 4255 | +} | |
| 4256 | + | |
| 4255 | 4257 | .mes_edit_buttons .menu_button, |
| 4256 | 4258 | .mes_reasoning_actions .edit_button { |
| 4257 | 4259 | opacity: 0.5; |
| @@ -4298,6 +4300,10 @@ input[type="range"]::-webkit-slider-thumb { | ||
| 4298 | 4300 | field-sizing: content; |
| 4299 | 4301 | } |
| 4300 | 4302 | |
| 4303 | +.mes.reasoning .mes_edit_add_reasoning { | |
| 4304 | + display: none; | |
| 4305 | +} | |
| 4306 | + | |
| 4301 | 4307 | #anchor_order { |
| 4302 | 4308 | margin-bottom: 15px; |
| 4303 | 4309 | } |