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:
@ -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