Reasoning inline edit improvements + style
| @@ -7306,6 +7306,11 @@ async function messageEditDone(div) { | |||
| 7306 | appendMediaToMessage(mes, div.closest('.mes')); | 7306 | appendMediaToMessage(mes, div.closest('.mes')); |
| 7307 | addCopyToCodeBlocks(div.closest('.mes')); | 7307 | addCopyToCodeBlocks(div.closest('.mes')); |
| 7308 | 7308 | ||
| 7309 | const reasoningEditDone = mesBlock.find('.mes_reasoning_edit_done:visible'); | ||
| 7310 | if (reasoningEditDone.length > 0) { | ||
| 7311 | reasoningEditDone.trigger('click'); | ||
| 7312 | } | ||
| 7313 | |||
| 7309 | await eventSource.emit(event_types.MESSAGE_UPDATED, this_edit_mes_id); | 7314 | await eventSource.emit(event_types.MESSAGE_UPDATED, this_edit_mes_id); |
| 7310 | this_edit_mes_id = undefined; | 7315 | this_edit_mes_id = undefined; |
| 7311 | await saveChatConditional(); | 7316 | await saveChatConditional(); |
| @@ -10813,6 +10818,12 @@ jQuery(async function () { | |||
| 10813 | var edit_mes_id = $(this).closest('.mes').attr('mesid'); | 10818 | var edit_mes_id = $(this).closest('.mes').attr('mesid'); |
| 10814 | this_edit_mes_id = edit_mes_id; | 10819 | this_edit_mes_id = edit_mes_id; |
| 10815 | 10820 | ||
| 10821 | // Also edit reasoning, if it exists | ||
| 10822 | const reasoningEdit = $(this).closest('.mes_block').find('.mes_reasoning_edit:visible'); | ||
| 10823 | if (reasoningEdit.length > 0) { | ||
| 10824 | reasoningEdit.trigger('click'); | ||
| 10825 | } | ||
| 10826 | |||
| 10816 | var text = chat[edit_mes_id]['mes']; | 10827 | var text = chat[edit_mes_id]['mes']; |
| 10817 | if (chat[edit_mes_id]['is_user']) { | 10828 | if (chat[edit_mes_id]['is_user']) { |
| 10818 | this_edit_mes_chname = name1; | 10829 | this_edit_mes_chname = name1; |
| @@ -10946,6 +10957,11 @@ jQuery(async function () { | |||
| 10946 | appendMediaToMessage(chat[this_edit_mes_id], $(this).closest('.mes')); | 10957 | appendMediaToMessage(chat[this_edit_mes_id], $(this).closest('.mes')); |
| 10947 | addCopyToCodeBlocks($(this).closest('.mes')); | 10958 | addCopyToCodeBlocks($(this).closest('.mes')); |
| 10948 | 10959 | ||
| 10960 | const reasoningEditDone = $(this).closest('.mes_block').find('.mes_reasoning_edit_cancel:visible'); | ||
| 10961 | if (reasoningEditDone.length > 0) { | ||
| 10962 | reasoningEditDone.trigger('click'); | ||
| 10963 | } | ||
| 10964 | |||
| 10949 | await eventSource.emit(event_types.MESSAGE_UPDATED, this_edit_mes_id); | 10965 | await eventSource.emit(event_types.MESSAGE_UPDATED, this_edit_mes_id); |
| 10950 | this_edit_mes_id = undefined; | 10966 | this_edit_mes_id = undefined; |
| 10951 | }); | 10967 | }); |
| @@ -11400,6 +11416,11 @@ jQuery(async function () { | |||
| 11400 | } | 11416 | } |
| 11401 | }); | 11417 | }); |
| 11402 | 11418 | ||
| 11419 | $(document).on('click', '.mes_reasoning_summary', function () { | ||
| 11420 | // If you toggle summary header while editing reasoning, yup - we just cancel it | ||
| 11421 | $(this).closest('.mes').find('.mes_reasoning_edit_cancel:visible').trigger('click'); | ||
| 11422 | }); | ||
| 11423 | |||
| 11403 | $(document).keyup(function (e) { | 11424 | $(document).keyup(function (e) { |
| 11404 | if (e.key === 'Escape') { | 11425 | if (e.key === 'Escape') { |
| 11405 | const isEditVisible = $('#curEditTextarea').is(':visible') || $('.reasoning_edit_textarea').length > 0; | 11426 | const isEditVisible = $('#curEditTextarea').is(':visible') || $('.reasoning_edit_textarea').length > 0; |
| @@ -106,6 +106,8 @@ | |||
| 106 | --tool-cool-color-picker-btn-bg: transparent; | 106 | --tool-cool-color-picker-btn-bg: transparent; |
| 107 | --tool-cool-color-picker-btn-border-color: transparent; | 107 | --tool-cool-color-picker-btn-border-color: transparent; |
| 108 | 108 | ||
| 109 | --mes-right-spacing: 30px; | ||
| 110 | |||
| 109 | --avatar-base-height: 50px; | 111 | --avatar-base-height: 50px; |
| 110 | --avatar-base-width: 50px; | 112 | --avatar-base-width: 50px; |
| 111 | --avatar-base-border-radius: 2px; | 113 | --avatar-base-border-radius: 2px; |
| @@ -345,12 +347,18 @@ input[type='checkbox']:focus-visible { | |||
| 345 | border-left: 2px solid var(--SmartThemeEmColor); | 347 | border-left: 2px solid var(--SmartThemeEmColor); |
| 346 | border-radius: 2px; | 348 | border-radius: 2px; |
| 347 | padding: 5px; | 349 | padding: 5px; |
| 348 | padding-left: 14px; | ||
| 349 | margin-bottom: 0.5rem; | 350 | margin-bottom: 0.5rem; |
| 350 | overflow-y: auto; | 351 | overflow-y: auto; |
| 351 | color: var(--SmartThemeEmColor); | 352 | color: var(--SmartThemeEmColor); |
| 352 | } | 353 | } |
| 353 | 354 | ||
| 355 | .mes_reasoning_details { | ||
| 356 | margin-right: var(--mes-right-spacing); | ||
| 357 | } | ||
| 358 | .mes_reasoning_details .mes_reasoning_summary { | ||
| 359 | margin-right: calc(var(--mes-right-spacing) * -1); | ||
| 360 | } | ||
| 361 | |||
| 354 | .mes_reasoning *:last-child { | 362 | .mes_reasoning *:last-child { |
| 355 | margin-bottom: 0; | 363 | margin-bottom: 0; |
| 356 | } | 364 | } |
| @@ -391,7 +399,6 @@ input[type='checkbox']:focus-visible { | |||
| 391 | .mes_bias:empty, | 399 | .mes_bias:empty, |
| 392 | .mes_reasoning:empty, | 400 | .mes_reasoning:empty, |
| 393 | .mes_reasoning_details:has(.mes_reasoning:empty), | 401 | .mes_reasoning_details:has(.mes_reasoning:empty), |
| 394 | .mes_block:has(.edit_textarea) .mes_reasoning_details, | ||
| 395 | .mes_reasoning_details:not([open]) .mes_reasoning_actions, | 402 | .mes_reasoning_details:not([open]) .mes_reasoning_actions, |
| 396 | .mes_reasoning_details:has(.reasoning_edit_textarea) .mes_reasoning, | 403 | .mes_reasoning_details:has(.reasoning_edit_textarea) .mes_reasoning, |
| 397 | .mes_reasoning_details:not(:has(.reasoning_edit_textarea)) .mes_reasoning_actions .edit_button, | 404 | .mes_reasoning_details:not(:has(.reasoning_edit_textarea)) .mes_reasoning_actions .edit_button, |
| @@ -1123,12 +1130,11 @@ body .panelControlBar { | |||
| 1123 | } | 1130 | } |
| 1124 | 1131 | ||
| 1125 | .last_mes:has(.mes_text:empty):has(.mes_reasoning_details[open]) .mes_reasoning:not(:empty) { | 1132 | .last_mes:has(.mes_text:empty):has(.mes_reasoning_details[open]) .mes_reasoning:not(:empty) { |
| 1126 | margin-bottom: 30px; | 1133 | margin-bottom: var(--mes-right-spacing); |
| 1127 | } | 1134 | } |
| 1128 | 1135 | ||
| 1129 | .last_mes .mes_reasoning, | ||
| 1130 | .last_mes .mes_text { | 1136 | .last_mes .mes_text { |
| 1131 | padding-right: 30px; | 1137 | padding-right: var(--mes-right-spacing); |
| 1132 | } | 1138 | } |
| 1133 | 1139 | ||
| 1134 | /* SWIPE RELATED STYLES*/ | 1140 | /* SWIPE RELATED STYLES*/ |