Thonk yeet
| @@ -6232,7 +6232,10 @@ | ||
| 6232 | 6232 | <details class="mes_reasoning_details"> |
| 6233 | 6233 | <summary class="mes_reasoning_summary"> |
| 6234 | 6234 | <span data-i18n="Reasoning">Reasoning</span> |
| 6235 | - <div class="mes_reasoning_copy mes_button fa-solid fa-copy" title="Copy reasoning" data-i18n="[title]Copy reasoning"></div> | |
| 6235 | + <div class="mes_reasoning_actions"> | |
| 6236 | + <div class="mes_reasoning_copy mes_button fa-solid fa-copy" title="Copy reasoning" data-i18n="[title]Copy reasoning"></div> | |
| 6237 | + <div class="mes_reasoning_delete mes_button fa-solid fa-trash-can" title="Remove reasoning" data-i18n="[title]Remove reasoning"></div> | |
| 6238 | + </div> | |
| 6236 | 6239 | </summary> |
| 6237 | 6240 | <div class="mes_reasoning"></div> |
| 6238 | 6241 | </details> |
| @@ -23,6 +23,7 @@ import { | ||
| 23 | 23 | neutralCharacterName, |
| 24 | 24 | updateChatMetadata, |
| 25 | 25 | system_message_types, |
| 26 | + updateMessageBlock, | |
| 26 | 27 | } from '../script.js'; |
| 27 | 28 | import { selected_group } from './group-chats.js'; |
| 28 | 29 | import { power_user } from './power-user.js'; |
| @@ -1573,9 +1574,30 @@ jQuery(function () { | ||
| 1573 | 1574 | e.preventDefault(); |
| 1574 | 1575 | }); |
| 1575 | 1576 | |
| 1577 | + $(document).on('click', '.mes_reasoning_delete', async function (e) { | |
| 1578 | + e.stopPropagation(); | |
| 1579 | + e.preventDefault(); | |
| 1580 | + | |
| 1581 | + const confirm = await Popup.show.confirm(t`Are you sure you want to clear the reasoning?`, t`Visible message contents will stay intact.`); | |
| 1582 | + | |
| 1583 | + if (!confirm) { | |
| 1584 | + return; | |
| 1585 | + } | |
| 1586 | + | |
| 1587 | + const mesBlock = $(this).closest('.mes'); | |
| 1588 | + const mesId = Number(mesBlock.attr('mesid')); | |
| 1589 | + const message = chat[mesId]; | |
| 1590 | + if (!message?.extra){ | |
| 1591 | + return; | |
| 1592 | + } | |
| 1593 | + message.extra.reasoning = ''; | |
| 1594 | + await saveChatConditional(); | |
| 1595 | + updateMessageBlock(mesId, message); | |
| 1596 | + }); | |
| 1597 | + | |
| 1576 | 1598 | $(document).on('pointerup', '.mes_reasoning_copy', async function () { |
| 1577 | 1599 | const mesBlock = $(this).closest('.mes'); |
| 1578 | 1600 | const mesId = Number(mesBlock.attr('mesid')); |
| 1579 | 1601 | const message = chat[mesId]; |
| 1580 | 1602 | const reasoning = message?.extra?.reasoning; |
| 1581 | 1603 | |
| @@ -348,7 +348,6 @@ input[type='checkbox']:focus-visible { | ||
| 348 | 348 | padding: 5px; |
| 349 | 349 | margin: 5px 0; |
| 350 | 350 | overflow-y: auto; |
| 351 | - max-height: 70vh; | |
| 352 | 351 | } |
| 353 | 352 | |
| 354 | 353 | .mes_reasoning_summary { |
| @@ -356,18 +355,26 @@ input[type='checkbox']:focus-visible { | ||
| 356 | 355 | position: relative; |
| 357 | 356 | } |
| 358 | 357 | |
| 359 | 358 | .mes_reasoning_details:not([open]) .mes_reasoning_copymes_reasoning_actions { |
| 360 | 359 | display: none; |
| 361 | 360 | } |
| 362 | 361 | |
| 363 | 362 | .mes_reasoning_copymes_reasoning_actions { |
| 364 | 363 | position: absolute; |
| 365 | 364 | right: 0; |
| 366 | 365 | top: 0; |
| 366 | + | |
| 367 | + display: flex; | |
| 368 | + gap: 4px; | |
| 369 | + flex-wrap: nowrap; | |
| 370 | + justify-content: flex-end; | |
| 371 | + transition: all 200ms; | |
| 372 | + overflow-x: hidden; | |
| 373 | + padding: 1px; | |
| 367 | 374 | } |
| 368 | 375 | |
| 369 | 376 | .mes_reasoning_summary > span { |
| 370 | 377 | margin-left: 5px0.5em; |
| 371 | 378 | } |
| 372 | 379 | |
| 373 | 380 | .mes_reasoning_details:has(.mes_reasoning:empty), |