mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add thonk block copy
This commit is contained in:
@@ -6232,6 +6232,7 @@
|
|||||||
<details class="mes_reasoning_details">
|
<details class="mes_reasoning_details">
|
||||||
<summary class="mes_reasoning_summary">
|
<summary class="mes_reasoning_summary">
|
||||||
<span data-i18n="Reasoning">Reasoning</span>
|
<span data-i18n="Reasoning">Reasoning</span>
|
||||||
|
<div class="mes_reasoning_copy right_menu_button fa-solid fa-copy" title="Copy reasoning" data-i18n="[title]Copy reasoning"></div>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="mes_reasoning"></div>
|
<div class="mes_reasoning"></div>
|
||||||
</details>
|
</details>
|
||||||
|
@@ -37,6 +37,7 @@ import {
|
|||||||
saveBase64AsFile,
|
saveBase64AsFile,
|
||||||
extractTextFromOffice,
|
extractTextFromOffice,
|
||||||
download,
|
download,
|
||||||
|
copyText,
|
||||||
} from './utils.js';
|
} from './utils.js';
|
||||||
import { extension_settings, renderExtensionTemplateAsync, saveMetadataDebounced } from './extensions.js';
|
import { extension_settings, renderExtensionTemplateAsync, saveMetadataDebounced } from './extensions.js';
|
||||||
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
|
import { POPUP_RESULT, POPUP_TYPE, Popup, callGenericPopup } from './popup.js';
|
||||||
@@ -1567,6 +1568,25 @@ jQuery(function () {
|
|||||||
$(document).on('click', '.mes_img_enlarge', enlargeMessageImage);
|
$(document).on('click', '.mes_img_enlarge', enlargeMessageImage);
|
||||||
$(document).on('click', '.mes_img_delete', deleteMessageImage);
|
$(document).on('click', '.mes_img_delete', deleteMessageImage);
|
||||||
|
|
||||||
|
$(document).on('click', '.mes_reasoning_copy', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('pointerup', '.mes_reasoning_copy', async function () {
|
||||||
|
const mesBlock = $(this).closest('.mes');
|
||||||
|
const mesId = mesBlock.attr('mesid');
|
||||||
|
const message = chat[mesId];
|
||||||
|
const reasoning = message?.extra?.reasoning;
|
||||||
|
|
||||||
|
if (!reasoning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await copyText(reasoning);
|
||||||
|
toastr.info(t`Copied!`, '', { timeOut: 2000 });
|
||||||
|
});
|
||||||
|
|
||||||
$('#file_form_input').on('change', async () => {
|
$('#file_form_input').on('change', async () => {
|
||||||
const fileInput = document.getElementById('file_form_input');
|
const fileInput = document.getElementById('file_form_input');
|
||||||
if (!(fileInput instanceof HTMLInputElement)) return;
|
if (!(fileInput instanceof HTMLInputElement)) return;
|
||||||
|
@@ -345,6 +345,17 @@ input[type='checkbox']:focus-visible {
|
|||||||
|
|
||||||
.mes_reasoning_summary {
|
.mes_reasoning_summary {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mes_reasoning_details:not([open]) .mes_reasoning_copy {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mes_reasoning_copy {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mes_reasoning_summary > span {
|
.mes_reasoning_summary > span {
|
||||||
|
Reference in New Issue
Block a user