Show warnings when prompt bits are overridden by the character card.

This commit is contained in:
Cohee
2023-06-08 23:37:52 +03:00
parent 8c73bbf2c5
commit a95e321099
3 changed files with 32 additions and 8 deletions

View File

@@ -988,6 +988,9 @@
<div class="fa-solid fa-clock-rotate-left "></div>
</div>
</div>
<div class="prompt_overridden">
Overridden by the Character Definitions.
</div>
<div class="toggle-description justifyLeft" data-i18n="The main prompt used to set the model behavior">
The main prompt used to set the model behavior
</div>
@@ -1030,6 +1033,9 @@
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="jailbreak_overridden">
Overridden by the Character Definitions.
</div>
<div class="toggle-description justifyLeft" data-i18n="Prompt that is used when the Jailbreak toggle is on">
Prompt that is used when the Jailbreak toggle is on
</div>
@@ -1546,6 +1552,9 @@
<label>
<span data-i18n="System Prompt">System Prompt</span>
</label>
<div class="prompt_overridden">
Overridden by the Character Definitions.
</div>
<textarea id="instruct_system_prompt" class="text_pole textarea_compact"></textarea>
<div class="flex-container">
<div class="flex1">
@@ -1801,11 +1810,8 @@
<div id="world_popup">
<hr>
<div id="world_popup_text">
<!-- <div id="world_cross" class="fa-solid fa-circle-xmark"></div> -->
<div id="world_popup_header" class="flex-container flexGap5">
<!-- Consider changing logo to something else -->
<div class="world_popup_logo_block">
<!-- <img src="img/book2.png" id="world_logo"> -->
<h3>
World Info Editor
<a href="https://docs.sillytavern.app/usage/guidebook/#world-info-entry" class="notes-link" target="_blank"><span class="note-link-span">?</span></a>
@@ -1813,7 +1819,6 @@
</div>
<div id="OpenAllWIEntries" class="menu_button fa-solid fa-expand"></div>
<div id="CloseAllWIEntries" class="menu_button fa-solid fa-compress"></div>
<!-- <div class="world_popup_expander">&nbsp;</div> -->
<form id="form_rename_world" action="javascript:void(null);" method="post" enctype="multipart/form-data">
<input id="world_popup_name" name="world_popup_name" class="text_pole" maxlength="99" size="32" value="" autocomplete="off">
<input id="world_popup_name_button" class="menu_button" type="submit" value="Rename">
@@ -1826,7 +1831,6 @@
<div id="world_popup_bottom_holder">
<div id="world_popup_new" class="menu_button">New Entry</div>
<!-- <span class="world_popup_expander">&nbsp;</span> -->
<div id="world_popup_export" class="menu_button">Export</div>
<div id="world_popup_delete" class="menu_button">Delete World</div>
</div>
@@ -2469,11 +2473,11 @@
<div class="inline-drawer-content">
<div>
<h4>System Prompt</h4>
<textarea id="system_prompt_textarea" name="system_prompt" placeholder="(Overrides the main prompt for OpenAI and/or system prompt for Instruct Mode if not empty)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
<textarea id="system_prompt_textarea" name="system_prompt" placeholder="(Overrides the main prompt for Chat Completion and/or system prompt for Instruct Mode if not empty)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea>
</div>
<div>
<h4>Post History Instructions</h4>
<textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="(Overrides the default jailbreak for OpenAI if not empty)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="100"></textarea>
<textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="(Overrides the default jailbreak for Chat Completion if not empty)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="100"></textarea>
</div>
</div>
</div>

View File

@@ -5446,6 +5446,19 @@ function updateVisibleDivs(containerSelector, resizecontainer) {
});
}
function displayOverrideWarnings() {
if (!this_chid) {
return;
}
$('.prompt_overridden').toggle(!!(characters[this_chid]?.data?.system_prompt));
$('.jailbreak_overridden').toggle(!!(characters[this_chid]?.data?.post_history_instructions));
}
// Check for override warnings every 5 seconds...
setInterval(displayOverrideWarnings, 5000);
// ...or when the chat changes
eventSource.on(event_types.CHAT_CHANGED, displayOverrideWarnings);
function importCharacter(file) {
const ext = file.name.match(/\.(\w+)$/);

View File

@@ -3999,6 +3999,13 @@ toolcool-color-picker {
align-items: center;
}
.prompt_overridden,
.jailbreak_overridden {
color: var(--SmartThemeQuoteColor);
font-weight: bold;
font-style: italic;
}
.openai_restorable .right_menu_button img {
height: 20px;
}
@@ -4597,4 +4604,4 @@ body.waifuMode #avatar_zoom_popup {
overflow-y: auto;
overflow-x: hidden;
}
}
}