From 347a515c2553df5ff03d0f853be1732175f8d2ba Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 25 Jan 2025 21:38:57 +0200 Subject: [PATCH] Thonk yeet --- public/index.html | 5 ++++- public/scripts/chats.js | 24 +++++++++++++++++++++++- public/style.css | 15 +++++++++++---- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index a966636a8..ded856d90 100644 --- a/public/index.html +++ b/public/index.html @@ -6232,7 +6232,10 @@
Reasoning -
+
+
+
+
diff --git a/public/scripts/chats.js b/public/scripts/chats.js index e30b090ed..43dbb9b0c 100644 --- a/public/scripts/chats.js +++ b/public/scripts/chats.js @@ -23,6 +23,7 @@ import { neutralCharacterName, updateChatMetadata, system_message_types, + updateMessageBlock, } from '../script.js'; import { selected_group } from './group-chats.js'; import { power_user } from './power-user.js'; @@ -1573,9 +1574,30 @@ jQuery(function () { e.preventDefault(); }); + $(document).on('click', '.mes_reasoning_delete', async function (e) { + e.stopPropagation(); + e.preventDefault(); + + const confirm = await Popup.show.confirm(t`Are you sure you want to clear the reasoning?`, t`Visible message contents will stay intact.`); + + if (!confirm) { + return; + } + + const mesBlock = $(this).closest('.mes'); + const mesId = Number(mesBlock.attr('mesid')); + const message = chat[mesId]; + if (!message?.extra){ + return; + } + message.extra.reasoning = ''; + await saveChatConditional(); + updateMessageBlock(mesId, message); + }); + $(document).on('pointerup', '.mes_reasoning_copy', async function () { const mesBlock = $(this).closest('.mes'); - const mesId = mesBlock.attr('mesid'); + const mesId = Number(mesBlock.attr('mesid')); const message = chat[mesId]; const reasoning = message?.extra?.reasoning; diff --git a/public/style.css b/public/style.css index 2564b72d9..2b7ce0a01 100644 --- a/public/style.css +++ b/public/style.css @@ -348,7 +348,6 @@ input[type='checkbox']:focus-visible { padding: 5px; margin: 5px 0; overflow-y: auto; - max-height: 70vh; } .mes_reasoning_summary { @@ -356,18 +355,26 @@ input[type='checkbox']:focus-visible { position: relative; } -.mes_reasoning_details:not([open]) .mes_reasoning_copy { +.mes_reasoning_details:not([open]) .mes_reasoning_actions { display: none; } -.mes_reasoning_copy { +.mes_reasoning_actions { position: absolute; right: 0; top: 0; + + display: flex; + gap: 4px; + flex-wrap: nowrap; + justify-content: flex-end; + transition: all 200ms; + overflow-x: hidden; + padding: 1px; } .mes_reasoning_summary > span { - margin-left: 5px; + margin-left: 0.5em; } .mes_reasoning_details:has(.mes_reasoning:empty),