Add thonk block copy
| @@ -6232,6 +6232,7 @@ | |||
| 6232 | <details class="mes_reasoning_details"> | 6232 | <details class="mes_reasoning_details"> |
| 6233 | <summary class="mes_reasoning_summary"> | 6233 | <summary class="mes_reasoning_summary"> |
| 6234 | <span data-i18n="Reasoning">Reasoning</span> | 6234 | <span data-i18n="Reasoning">Reasoning</span> |
| 6235 | <div class="mes_reasoning_copy right_menu_button fa-solid fa-copy" title="Copy reasoning" data-i18n="[title]Copy reasoning"></div> | ||
| 6235 | </summary> | 6236 | </summary> |
| 6236 | <div class="mes_reasoning"></div> | 6237 | <div class="mes_reasoning"></div> |
| 6237 | </details> | 6238 | </details> |
| @@ -37,6 +37,7 @@ import { | |||
| 37 | saveBase64AsFile, | 37 | saveBase64AsFile, |
| 38 | extractTextFromOffice, | 38 | extractTextFromOffice, |
| 39 | download, | 39 | download, |
| 40 | copyText, | ||
| 40 | } from './utils.js'; | 41 | } from './utils.js'; |
| 41 | import { extension_settings, renderExtensionTemplateAsync, saveMetadataDebounced } from './extensions.js'; | 42 | import { extension_settings, renderExtensionTemplateAsync, saveMetadataDebounced } from './extensions.js'; |
| 42 | import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; | 43 | import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js'; |
| @@ -1567,6 +1568,25 @@ jQuery(function () { | |||
| 1567 | $(document).on('click', '.mes_img_enlarge', enlargeMessageImage); | 1568 | $(document).on('click', '.mes_img_enlarge', enlargeMessageImage); |
| 1568 | $(document).on('click', '.mes_img_delete', deleteMessageImage); | 1569 | $(document).on('click', '.mes_img_delete', deleteMessageImage); |
| 1569 | 1570 | ||
| 1571 | $(document).on('click', '.mes_reasoning_copy', (e) => { | ||
| 1572 | e.stopPropagation(); | ||
| 1573 | e.preventDefault(); | ||
| 1574 | }); | ||
| 1575 | |||
| 1576 | $(document).on('pointerup', '.mes_reasoning_copy', async function () { | ||
| 1577 | const mesBlock = $(this).closest('.mes'); | ||
| 1578 | const mesId = mesBlock.attr('mesid'); | ||
| 1579 | const message = chat[mesId]; | ||
| 1580 | const reasoning = message?.extra?.reasoning; | ||
| 1581 | |||
| 1582 | if (!reasoning) { | ||
| 1583 | return; | ||
| 1584 | } | ||
| 1585 | |||
| 1586 | await copyText(reasoning); | ||
| 1587 | toastr.info(t`Copied!`, '', { timeOut: 2000 }); | ||
| 1588 | }); | ||
| 1589 | |||
| 1570 | $('#file_form_input').on('change', async () => { | 1590 | $('#file_form_input').on('change', async () => { |
| 1571 | const fileInput = document.getElementById('file_form_input'); | 1591 | const fileInput = document.getElementById('file_form_input'); |
| 1572 | if (!(fileInput instanceof HTMLInputElement)) return; | 1592 | if (!(fileInput instanceof HTMLInputElement)) return; |
| @@ -345,6 +345,17 @@ input[type='checkbox']:focus-visible { | |||
| 345 | 345 | ||
| 346 | .mes_reasoning_summary { | 346 | .mes_reasoning_summary { |
| 347 | cursor: pointer; | 347 | cursor: pointer; |
| 348 | position: relative; | ||
| 349 | } | ||
| 350 | |||
| 351 | .mes_reasoning_details:not([open]) .mes_reasoning_copy { | ||
| 352 | display: none; | ||
| 353 | } | ||
| 354 | |||
| 355 | .mes_reasoning_copy { | ||
| 356 | position: absolute; | ||
| 357 | right: 0; | ||
| 358 | top: 0; | ||
| 348 | } | 359 | } |
| 349 | 360 | ||
| 350 | .mes_reasoning_summary > span { | 361 | .mes_reasoning_summary > span { |