Thonk yeet

347a515c2553df5ff03d0f853be1732175f8d2ba

Cohee <18619528+Cohee1207@users.noreply.github.com>

3 files changed, +37 -5Showing whitespace changes
public/index.html+3 -0
@@ -6232,7 +6232,10 @@
62326232 <details class="mes_reasoning_details">
62336233 <summary class="mes_reasoning_summary">
62346234 <span data-i18n="Reasoning">Reasoning</span>
6235+ <div class="mes_reasoning_actions">
62356236 <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>
62366239 </summary>
62376240 <div class="mes_reasoning"></div>
62386241 </details>
public/scripts/chats.js+23 -1
@@ -23,6 +23,7 @@ import {
2323 neutralCharacterName,
2424 updateChatMetadata,
2525 system_message_types,
26+ updateMessageBlock,
2627} from '../script.js';
2728import { selected_group } from './group-chats.js';
2829import { power_user } from './power-user.js';
@@ -1573,9 +1574,30 @@ jQuery(function () {
15731574 e.preventDefault();
15741575 });
15751576
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+
15761598 $(document).on('pointerup', '.mes_reasoning_copy', async function () {
15771599 const mesBlock = $(this).closest('.mes');
15781600 const mesId = Number(mesBlock.attr('mesid'));
15791601 const message = chat[mesId];
15801602 const reasoning = message?.extra?.reasoning;
15811603
public/style.css+11 -4
@@ -348,7 +348,6 @@ input[type='checkbox']:focus-visible {
348348 padding: 5px;
349349 margin: 5px 0;
350350 overflow-y: auto;
351- max-height: 70vh;
352351}
353352
354353.mes_reasoning_summary {
@@ -356,18 +355,26 @@ input[type='checkbox']:focus-visible {
356355 position: relative;
357356}
358357
359358.mes_reasoning_details:not([open]) .mes_reasoning_copymes_reasoning_actions {
360359 display: none;
361360}
362361
363362.mes_reasoning_copymes_reasoning_actions {
364363 position: absolute;
365364 right: 0;
366365 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;
367374}
368375
369376.mes_reasoning_summary > span {
370377 margin-left: 5px0.5em;
371378}
372379
373380.mes_reasoning_details:has(.mes_reasoning:empty),