mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add toggle for reasoning auto-expand
This commit is contained in:
@ -3789,6 +3789,12 @@
|
||||
Auto-Parse Reasoning
|
||||
</small>
|
||||
</label>
|
||||
<label class="checkbox_label" for="reasoning_auto_expand" title="Automatically expand reasoning blocks." data-i18n="[title]reasoning_auto_expand">
|
||||
<input id="reasoning_auto_expand" type="checkbox" />
|
||||
<small data-i18n="Auto-Expand Reasoning">
|
||||
Auto-Expand Reasoning
|
||||
</small>
|
||||
</label>
|
||||
<label class="checkbox_label" for="reasoning_add_to_prompts" title="Add existing reasoning blocks to prompts. To add a new reasoning block, use the message edit menu." data-i18n="[title]reasoning_add_to_prompts">
|
||||
<input id="reasoning_add_to_prompts" type="checkbox" />
|
||||
<small data-i18n="Add Reasoning to Prompts">
|
||||
@ -6247,7 +6253,7 @@
|
||||
<div class="mes_edit_cancel menu_button fa-solid fa-xmark" title="Cancel" data-i18n="[title]Cancel"></div>
|
||||
</div>
|
||||
</div>
|
||||
<details class="mes_reasoning_details" open>
|
||||
<details class="mes_reasoning_details">
|
||||
<summary class="mes_reasoning_summary flex-container">
|
||||
<div class="mes_reasoning_header_block flex-container">
|
||||
<div class="mes_reasoning_header flex-container">
|
||||
|
@ -22,6 +22,18 @@ function getMessageFromJquery(element) {
|
||||
return { messageId: messageId, message, messageBlock };
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the auto-expand state of reasoning blocks.
|
||||
*/
|
||||
function toggleReasoningAutoExpand() {
|
||||
const reasoningBlocks = document.querySelectorAll('details.mes_reasoning_details');
|
||||
reasoningBlocks.forEach((block) => {
|
||||
if (block instanceof HTMLDetailsElement) {
|
||||
block.open = power_user.reasoning.auto_expand;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class for adding reasoning to messages.
|
||||
* Keeps track of the number of reasoning additions.
|
||||
@ -118,6 +130,13 @@ function loadReasoningSettings() {
|
||||
power_user.reasoning.auto_parse = !!$(this).prop('checked');
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$('#reasoning_auto_expand').prop('checked', power_user.reasoning.auto_expand);
|
||||
$('#reasoning_auto_expand').on('change', function () {
|
||||
power_user.reasoning.auto_expand = !!$(this).prop('checked');
|
||||
toggleReasoningAutoExpand();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
}
|
||||
|
||||
function registerReasoningSlashCommands() {
|
||||
@ -444,6 +463,7 @@ function registerReasoningAppEvents() {
|
||||
|
||||
export function initReasoning() {
|
||||
loadReasoningSettings();
|
||||
toggleReasoningAutoExpand();
|
||||
setReasoningEventHandlers();
|
||||
registerReasoningSlashCommands();
|
||||
registerReasoningMacros();
|
||||
|
Reference in New Issue
Block a user