Auto-hide instruct sequences in <details>

This commit is contained in:
Cohee 2024-09-22 19:15:24 +03:00
parent 9d0ffc2d0d
commit bcc4914467
3 changed files with 112 additions and 83 deletions

View File

@ -3357,6 +3357,54 @@
</span>
</b>
</h4>
<!-- We keep one auto-open so the user would know what is going on in the picked template -->
<details open>
<summary>User Message Sequences</summary>
<div class="flex-container">
<div class="flexAuto" title="Inserted before a User message and as a last prompt line when impersonating." data-i18n="[title]Inserted before a User message and as a last prompt line when impersonating.">
<small data-i18n="User Prefix">User Message Prefix</small>
<textarea id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" title="Inserted after a User message." data-i18n="[title]Inserted after a User message.">
<small data-i18n="User Suffix">User Message Suffix</small>
<textarea id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
</details>
<details>
<summary>Assistant Message Sequences</summary>
<div class="flex-container">
<div class="flexAuto" title="Inserted before an Assistant message and as a last prompt line when generating an AI reply." data-i18n="[title]Inserted before an Assistant message and as a last prompt line when generating an AI reply.">
<small data-i18n="Assistant Prefix">Assistant Message Prefix</small>
<textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message.">
<small data-i18n="Assistant Suffix">Assistant Message Suffix</small>
<textarea id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
</details>
<details>
<summary>System Message Sequences</summary>
<div class="flex-container">
<div class="flexAuto" id="instruct_system_sequence_block" title="Inserted before a System (added by slash commands or extensions) message." data-i18n="[title]Inserted before a System (added by slash commands or extensions) message.">
<small data-i18n="System Prefix">System Message Prefix</small>
<textarea id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" id="instruct_system_suffix_block" title="Inserted after a System message." data-i18n="[title]Inserted after a System message.">
<small data-i18n="System Suffix">System Message Suffix</small>
<textarea id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
<div class="flexBasis100p" title="If enabled, System Sequences will be the same as User Sequences." data-i18n="[title]If enabled, System Sequences will be the same as User Sequences.">
<label class="checkbox_label" for="instruct_system_same_as_user">
<input id="instruct_system_same_as_user" type="checkbox" />
<small data-i18n="System same as User">System same as User</small>
</label>
</div>
</details>
<details>
<summary>System Prompt Sequences</summary>
<div class="flex-container">
<div class="flexAuto" title="Inserted before a System prompt." data-i18n="[title]Inserted before a System prompt.">
<label for="instruct_system_sequence_prefix">
@ -3375,46 +3423,9 @@
</div>
</div>
</div>
<div class="flex-container">
<div class="flexAuto" title="Inserted before a User message and as a last prompt line when impersonating." data-i18n="[title]Inserted before a User message and as a last prompt line when impersonating.">
<small data-i18n="User Prefix">User Message Prefix</small>
<textarea id="instruct_input_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" title="Inserted after a User message." data-i18n="[title]Inserted after a User message.">
<small data-i18n="User Suffix">User Message Suffix</small>
<textarea id="instruct_input_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
<div class="flex-container">
<div class="flexAuto" title="Inserted before an Assistant message and as a last prompt line when generating an AI reply." data-i18n="[title]Inserted before an Assistant message and as a last prompt line when generating an AI reply.">
<small data-i18n="Assistant Prefix">Assistant Message Prefix</small>
<textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" title="Inserted after an Assistant message." data-i18n="[title]Inserted after an Assistant message.">
<small data-i18n="Assistant Suffix">Assistant Message Suffix</small>
<textarea id="instruct_output_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
<div class="flex-container">
<div class="flexAuto" id="instruct_system_sequence_block" title="Inserted before a System (added by slash commands or extensions) message." data-i18n="[title]Inserted before a System (added by slash commands or extensions) message.">
<small data-i18n="System Prefix">System Message Prefix</small>
<textarea id="instruct_system_sequence" class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
<div class="flexAuto" id="instruct_system_suffix_block" title="Inserted after a System message." data-i18n="[title]Inserted after a System message.">
<small data-i18n="System Suffix">System Message Suffix</small>
<textarea id="instruct_system_suffix" class="text_pole wide100p textarea_compact autoSetHeight"></textarea>
</div>
</div>
<div class="flexBasis100p" title="If enabled, System Sequences will be the same as User Sequences." data-i18n="[title]If enabled, System Sequences will be the same as User Sequences.">
<label class="checkbox_label" for="instruct_system_same_as_user">
<input id="instruct_system_same_as_user" type="checkbox" />
<small data-i18n="System same as User">System same as User</small>
</label>
</div>
<h5 class="textAlignCenter" data-i18n="Misc. Sequences">
Misc. Sequences
</h5>
</details>
<details>
<summary data-i18n="Misc. Sequences">Misc. Sequences</summary>
<div class="flex-container">
<div class="flexAuto" title="Inserted before the first Assistant's message." data-i18n="[title]Inserted before the first Assistant's message.">
<small data-i18n="First Assistant Prefix">First Assistant Prefix</small>
@ -3451,6 +3462,7 @@
<textarea id="instruct_user_alignment_message" class="text_pole textarea_compact autoSetHeight"></textarea>
</div>
</div>
</details>
</div>
</div>
<div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">

View File

@ -682,4 +682,12 @@ jQuery(() => {
selectMatchingContextTemplate(name);
}
});
if (!CSS.supports('field-sizing', 'content')) {
$('#InstructSequencesColumn details').on('toggle', function () {
if ($(this).prop('open')) {
resetScrollHeight($(this).find('textarea'));
}
});
}
});

View File

@ -5469,3 +5469,12 @@ body:not(.movingUI) .drawer-content.maximized {
#AdvancedFormatting .autoSetHeight {
overflow-wrap: anywhere;
}
#InstructSequencesColumn summary {
font-size: 0.95em;
cursor: pointer;
}
#InstructSequencesColumn details:not(:last-of-type) {
margin-bottom: 5px;
}