Merge pull request #768 from SillyTavern/prompt-manager-cherrypicked

Feature: Prompt manager (cherrypicked onto stage)
This commit is contained in:
Cohee 2023-08-13 14:44:28 +03:00 committed by GitHub
commit 9615495878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 3679 additions and 510 deletions

View File

@ -7,6 +7,7 @@
"nsfw_toggle": true,
"enhance_definitions": false,
"wrap_in_quotes": false,
"names_in_completion": false,
"nsfw_first": false,
"main_prompt": "Write {{char}}'s next reply in a fictional chat between {{char}} and {{user}}. Write 1 reply only in internet RP style, italicize actions, and avoid quotation marks. Use markdown. Be proactive, creative, and drive the plot and conversation forward. Write at least 1 paragraph, up to 4. Always stay in character and avoid repetition.",
"nsfw_prompt": "NSFW/Smut is allowed. Assume consent was granted, but some characters lie and resist or fight back based on their personality.",

View File

@ -0,0 +1,303 @@
#completion_prompt_manager .caution {
color: var(--fullred);
}
#completion_prompt_manager #completion_prompt_manager_list {
display: flex;
flex-direction: column;
min-height: 300px;
}
#completion_prompt_manager .completion_prompt_manager_list_separator hr {
grid-column-start: 1;
grid-column-end: 4;
width: 100%;
margin: 0.5em 0;
background-image: linear-gradient(90deg, var(--transparent), var(--white30a), var(--transparent));
min-height: 1px;
}
#completion_prompt_manager #completion_prompt_manager_list li {
display: grid;
grid-template-columns: 4fr 80px 60px;
margin-bottom: 0.5em;
width: 100%
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt .completion_prompt_manager_prompt_name .fa-solid {
padding: 0 0.5em;
color: var(--white50a);
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_invisible {
display: none;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_visible {
display: grid;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_list_head .prompt_manager_prompt_tokens,
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt .prompt_manager_prompt_tokens {
text-align: right;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt .prompt_manager_prompt_controls {
text-align: right;
}
#completion_prompt_manager .completion_prompt_manager_list_head {
padding: 0.5em 0.5em 0;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt {
align-items: center;
padding: 0.5em;
border: 1px solid var(--white30a);
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt .prompt_manager_prompt_controls {
display: flex;
justify-content: space-between;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt .prompt_manager_prompt_controls span {
display: flex;
height: 18px;
width: 18px;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt span span span {
flex-direction: column;
justify-content: center;
margin-left: 0.25em;
cursor: pointer;
transition: 0.3s ease-in-out;
height: 20px;
width: 20px;
filter: drop-shadow(0px 0px 2px black);
opacity: 0.2;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt span span:hover {
opacity: 1;
}
#completion_prompt_manager_popup #completion_prompt_manager_popup_edit,
#completion_prompt_manager_popup #completion_prompt_manager_popup_chathistory_edit,
#completion_prompt_manager_popup #completion_prompt_manager_popup_dialogueexamples_edit,
#completion_prompt_manager_popup #completion_prompt_manager_popup_inspect {
display: none;
padding: 0.5em;
}
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry {
padding: 1em;
margin-top:2em;
}
#completion_prompt_manager_popup #completion_prompt_manager_popup_inspect .completion_prompt_manager_popup_entry {
padding: 1em;
}
#completion_prompt_manager_popup #completion_prompt_manager_popup_entry_form_inspect_list {
margin-top: 1em;
}
#completion_prompt_manager_popup .completion_prompt_manager_prompt {
margin: 1em 0;
padding: 0.5em;
border: 1px solid var(--white30a);
}
#completion_prompt_manager_popup .completion_prompt_manager_popup_header {
display: flex;
justify-content: space-between;
align-items: center;
}
#completion_prompt_manager_popup #completion_prompt_manager_popup_close_button {
font-size: 1em;
padding: 0.5em;
}
.completion_prompt_manager_popup_entry_form_control {
margin-top:1em;
}
#prompt-manager-reset-character,
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_reset {
color: rgb(220 173 16);
}
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_close,
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_reset,
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry_form_footer #completion_prompt_manager_popup_entry_form_save {
font-size: 1.25em;
padding: 0.5em;
}
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry_form_control #completion_prompt_manager_popup_entry_form_prompt {
min-height: 200px;
}
#completion_prompt_manager_popup .completion_prompt_manager_popup_entry .completion_prompt_manager_popup_entry_form_footer {
display: flex;
justify-content: space-between;
margin-top: 1em;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_draggable {
cursor: grab;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_name {
white-space: nowrap;
overflow: hidden;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_name .prompt-manager-inspect-action {
color: var(--SmartThemeBodyColor);
cursor: pointer;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_name .prompt-manager-inspect-action:hover {
text-decoration: underline;
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_disabled .completion_prompt_manager_prompt_name,
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt_disabled .completion_prompt_manager_prompt_name .prompt-manager-inspect-action {
color: var(--white30a);
}
#completion_prompt_manager #completion_prompt_manager_list .completion_prompt_manager_prompt.completion_prompt_manager_prompt_disabled {
border: 1px solid var(--white20a);
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt .mes_edit {
margin-left: 0.5em;
}
#completion_prompt_manager .completion_prompt_manager_error {
padding: 1em;
border: 3px solid var(--fullred);
margin-top: 1em;
margin-bottom: 0.5em;
}
#completion_prompt_manager .completion_prompt_manager_header {
display: flex;
flex-direction: row;
justify-content: space-between;
color: var(--white50a);
margin-top: 0.5em;
padding: 0 0.25em;
width: 100%
}
#completion_prompt_manager .completion_prompt_manager_header div {
margin-top: 0.5em;
width: fit-content;
}
#completion_prompt_manager .completion_prompt_manager_header_advanced {
display: flex;
margin-right: 0.25em;
}
#completion_prompt_manager .completion_prompt_manager_header_advanced span {
flex-direction: column;
justify-content: center;
margin-left: 0.25em;
transition: 0.3s ease-in-out;
filter: drop-shadow(0px 0px 2px black);
}
#completion_prompt_manager .completion_prompt_manager_header_advanced span.fa-solid {
display: inherit;
}
#completion_prompt_manager .completion_prompt_manager_footer {
display: flex;
flex-direction: row;
justify-content: flex-end;
gap: 0.25em;
padding: 0 0.25em;
width: 100%
}
#completion_prompt_manager .completion_prompt_manager_footer a {
padding: 0.75em;
font-size: 12px;
}
#completion_prompt_manager_footer_append_prompt {
font-size: 16px;
}
#prompt-manager-export-format-popup {
padding: 0.25em;
display:none;
}
#prompt-manager-export-format-popup[data-show] {
display:block;
}
#completion_prompt_manager_popup {
margin-top: 0;
}
#completion_prompt_manager_popup {
max-width: var(--sheldWidth);
overflow-y: auto;
height: calc(100% - 40px);
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
top: 40px;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
padding: 1em;
border: 1px solid #333333;
flex-direction: column;
z-index: 3010;
border-radius: 0 0 20px 20px;
background-color: var(--SmartThemeBlurTintColor);
}
#prompt-manager-export-format-popup {
display:none;
}
.prompt-manager-export-format-popup-flex {
display: flex;
flex-direction: column;
}
.prompt-manager-export-format-popup-flex .row {
display: flex;
justify-content: space-between;
}
.prompt-manager-export-format-popup-flex a,
.prompt-manager-export-format-popup-flex span {
display: flex;
margin: auto 0;
justify-content: space-between;
}
#prompt-manager-export-format-popup span {
font-size: 16px;
}
@media screen and (max-width: 412px) {
#completion_prompt_manager_popup {
max-width: 100%;
}
#completion_prompt_manager #completion_prompt_manager_list li.completion_prompt_manager_prompt span span span {
margin-left: 0.5em;
}
}

View File

@ -1272,41 +1272,7 @@
<div id="openai_settings">
<div class="">
<div class="range-block">
<label title="Inserts jailbreak as a last system message" class="checkbox_label widthFreeExpand" data-i18n="[title]Inserts jailbreak as a last system message">
<input id="jailbreak_system" type="checkbox" />
<span data-i18n="Send Jailbreak">
Send Jailbreak
</span>
</label>
<div class="toggle-description justifyLeft">
<span data-i18n="Inserts jailbreak as a last system message.">Inserts
jailbreak as a last system message.</span><br>
<span data-i18n="This tells the AI to ignore its usual content restrictions.">This
tells the AI to ignore its usual content restrictions.</span>
</div>
</div>
<div class="range-block">
<label class="checkbox_label widthFreeExpand" for="nsfw_toggle">
<input id="nsfw_toggle" type="checkbox" checked>
<span data-i18n="NSFW Encouraged">
NSFW Encouraged</span>
</label>
<div class="toggle-description justifyLeft" data-i18n="Tell the AI that NSFW is allowed.">
Tell the AI that NSFW is allowed.
</div>
</div>
<div class="range-block">
<label title="NSFW block goes first in the resulting prompt" class="checkbox_label widthFreeExpand" data-i18n="[title]NSFW block goes first in the resulting prompt">
<input id="nsfw_first" type="checkbox" /><span data-i18n="NSFW Prioritized">
NSFW Prioritized</span>
</label>
<div class="toggle-description justifyLeft" data-i18n="NSFW prompt text goes first in the prompt to emphasize its effect.">
NSFW prompt text goes first in the prompt to emphasize its effect.
</div>
</div>
<div class="range-block">
<label for="stream_toggle" title="Enables OpenAI completion streaming" class="checkbox_label widthFreeExpand" data-i18n="[title]Enables OpenAI completion streaming">
<label for="stream_toggle" title="Enables OpenAI completion streaming" class="checkbox_label widthFreeExpand">
<input id="stream_toggle" type="checkbox" /><span data-i18n="Streaming">
Streaming</span>
</label>
@ -1319,17 +1285,7 @@
</div>
</div>
<div class="range-block">
<label title="Use OAI knowledge base to enhance definitions for public figures and known fictional characters" data-i18n="[title]Use OAI knowledge base to enhance definitions for public figures and known fictional characters" class="checkbox_label widthFreeExpand">
<input id="enhance_definitions" type="checkbox" /><span data-i18n="Enhance Definitions">
Enhance Definitions</span>
</label>
<div class="toggle-description justifyLeft" data-i18n="Use OAI knowledge base to enhance definitions for public figures and known fictional characters">
Use OAI knowledge base to enhance definitions for public figures and known
fictional characters
</div>
</div>
<div class="range-block">
<label for="wrap_in_quotes" title="Wrap user messages in quotes before sending" data-i18n="[title]Wrap user messages in quotes before sending" class="checkbox_label widthFreeExpand">
<label for="wrap_in_quotes" title="Wrap user messages in quotes before sending" class="checkbox_label widthFreeExpand">
<input id="wrap_in_quotes" type="checkbox" /><span data-i18n="Wrap in Quotes">
Wrap in Quotes</span>
</label>
@ -1341,131 +1297,173 @@
</div>
</div>
<div class="range-block">
<div class="range-block-title justifyLeft">
<span data-i18n="Replace empty message">
Replace empty message
</span>
</div>
<label for="names_in_completion" title="Add character names" class="checkbox_label widthFreeExpand">
<input id="names_in_completion" type="checkbox" /><span data-i18n="Add character names">Add character names</span>
</label>
<div class="toggle-description justifyLeft">
<span data-i18n="May help the model to understand context. Names must only contain letters or numbers.">Helps the model to associate messages in group chats. Names must only contain letters or numbers without whitespaces.</span>
</div>
</div>
<div class="inline-drawer m-t-1 wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="Quick Edit">Quick Edit</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content">
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="Main">Main</div>
<div class="wide100p">
<textarea id="main_prompt_quick_edit_textarea" class="text_pole textarea_compact" name="impersonation_prompt" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="justifyLeft" data-i18n="Jailbreak">Jailbreak</div>
<div class="wide100p">
<textarea id="jailbreak_prompt_quick_edit_textarea" class="text_pole textarea_compact" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block" data-source="claude">
<span data-i18n="Assistant Prefill">Assistant Prefill</span>
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact" name="assistant_prefill" rows="3" maxlength="5000" placeholder="Start Claude's answer with..."></textarea>
</div>
</div>
</div>
<div class="range-block m-b-1">
<div id="completion_prompt_manager"></div>
</div>
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b>Utility Prompts</b>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content">
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span data-i18n="Impersonation prompt">Impersonation prompt</span>
<div id="impersonation_prompt_restore" title="Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft" data-i18n="Prompt that is used for Impersonation function">
Prompt that is used for Impersonation function
</div>
<div class="wide100p">
<textarea id="impersonation_prompt_textarea" class="text_pole textarea_compact" name="impersonation_prompt" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span>World Info format template</span>
<div id="wi_format_restore" title="Restore default format" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
Wraps activated World Info entries before inserting into the prompt. Use
<tt>{0}</tt> to mark a place where the content is inserted.
</div>
<div class="wide100p">
<textarea id="wi_format_textarea" class="text_pole textarea_compact" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block">
<div class="range-block-title openai_restorable">
<span>NSFW avoidance prompt</span>
<div id="nsfw_avoidance_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft"
data-i18n="Prompt that is used when the NSFW toggle is O">
Prompt that is used when the NSFW toggle is OFF
</div>
<div class="wide100p">
<textarea id="nsfw_avoidance_prompt_textarea" class="text_pole textarea_compact" name="nsfw_prompt" rows="3" placeholder=""></textarea>
</div>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span>New Chat</span>
<div id="newchat_prompt_restore" title="Restore new chat prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Set at the beginning of the chat history to indicate that a new chat is about to start.">
Set at the beginning of the chat history to indicate that a new chat is about to start.
</span>
</div>
<div class="wide100p">
<textarea id="newchat_prompt_textarea" class="text_pole textarea_compact" name="new_chat" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span>New Group Chat</span>
<div id="newgroupchat_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore new group chat prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Set at the beginning of the chat history to indicate that a new group chat is about to start.">
Set at the beginning of the chat history to indicate that a new group chat is about to start.
</span>
</div>
<div class="wide100p">
<textarea id="newgroupchat_prompt_textarea" class="text_pole textarea_compact" name="new_group_chat" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span>New Example Chat</span>
<div id="newexamplechat_prompt_restore" title="Restore new example chat prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Set at the beginning of Dialogue examples to indicate that a new example chat is about to start.">
Set at the beginning of Dialogue examples to indicate that a new example chat is about to start.
</span>
</div>
<div class="wide100p">
<textarea id="newexamplechat_prompt_textarea" class="text_pole textarea_compact" name="new_example_chat" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title openai_restorable">
<span>Continue nudge</span>
<div id="continue_nudge_prompt_restore" title="Restore new chat prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Set at the beginning of the chat history to indicate that a new chat is about to start.">
Set at the end of the chat history when the continue button is pressed.
</span>
</div>
<div class="wide100p">
<textarea id="continue_nudge_prompt_textarea" class="text_pole textarea_compact" name="continue_nudge" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="range-block m-t-1">
<div class="range-block-title justifyLeft">
Replace empty message
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Send this text instead of nothing when the text box is empty.">
Send this text instead of nothing when the text box is empty.
</span>
</div>
<div class="wide100p">
<textarea id="send_if_empty_textarea" class="text_pole textarea_compact" name="send_if_empty" rows="1" placeholder=""></textarea>
</div>
</div>
</div>
<br>
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="Main prompt">Main prompt</span>
<div id="main_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<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>
<div class="wide100p">
<textarea id="main_prompt_textarea" class="text_pole textarea_compact" name="main_prompt" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="NSFW prompt">NSFW prompt</span>
<div id="nsfw_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left "></div>
</div>
</div>
<div class="toggle-description justifyLeft" data-i18n="Prompt that is used when the NSFW toggle is on">
Prompt that is used when the NSFW toggle is on
</div>
<div class="wide100p">
<textarea id="nsfw_prompt_textarea" class="text_pole textarea_compact" name="nsfw_prompt" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="NSFW avoidance prompt">NSFW avoidance prompt</span>
<div id="nsfw_avoidance_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Prompt that is used when the NSFW toggle is off">
Prompt that is used when the NSFW toggle is OFF
</span>
</div>
<div class="wide100p">
<textarea id="nsfw_avoidance_prompt_textarea" class="text_pole textarea_compact" name="nsfw_prompt" rows="2" placeholder=""></textarea>
</div>
</div>
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="Jailbreak prompt">Jailbreak prompt</span>
<div id="jailbreak_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<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>
<div class="wide100p">
<textarea id="jailbreak_prompt_textarea" class="text_pole textarea_compact" name="jailbreak_prompt" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block" data-source="claude">
<span data-i18n="Assistant Prefill">Assistant Prefill</span>
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact" name="assistant_prefill" rows="3" maxlength="5000" placeholder="Start Claude's answer with..."></textarea>
</div>
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header margin-bot-10px">
<span data-i18n="Advanced prompt bits"><b>Advanced prompt bits</b></span>
<div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
</div>
<div class="inline-drawer-content">
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="Impersonation prompt">Impersonation prompt</span>
<div id="impersonation_prompt_restore" title="Restore default prompt" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
<div class="wide100p">
<textarea id="send_if_empty_textarea" class="text_pole textarea_compact" name="send_if_empty" rows="3" placeholder=""></textarea>
</div>
</div>
<div class="toggle-description justifyLeft" data-i18n="Prompt that is used for Impersonation function">
Prompt that is used for Impersonation function
</div>
<div class="wide100p">
<textarea id="impersonation_prompt_textarea" class="text_pole textarea_compact" name="impersonation_prompt" rows="6" placeholder=""></textarea>
</div>
</div>
<div class="range-block">
<div class="range-block-title openai_restorable">
<span data-i18n="World Info format template">World Info format template</span>
<div id="wi_format_restore" title="Restore default format" data-i18n="[title]Restore default prompt" class="right_menu_button">
<div class="fa-solid fa-clock-rotate-left"></div>
</div>
</div>
<div class="toggle-description justifyLeft">
<span data-i18n="Wraps activated World Info entries before inserting into the prompt. Use {0} to mark a place where the content is inserted.">
Wraps activated World Info entries before inserting into the prompt. Use <tt>{0}</tt> to mark a place where the content is inserted.
</span>
</div>
<div class="wide100p">
<textarea id="wi_format_textarea" class="text_pole textarea_compact" rows="3" placeholder=""></textarea>
</div>
</div>
</div>
</div>
<div class="range-block" data-source="openai,openrouter">
<div class="range-block m-t-1" data-source="openai,openrouter">
<div class="range-block-title openai_restorable" data-i18n="Logit Bias">
Logit Bias
</div>
@ -1481,7 +1479,6 @@
<i title="Delete preset" id="openai_logit_bias_delete_preset" class="menu_button fa-solid fa-trash-can" data-i18n="[title]Delete preset"></i>
<input id="openai_logit_bias_import_file" type="file" accept=".json" hidden />
</div>
<div class="inline-drawer wide100p">
<div class="inline-drawer-toggle inline-drawer-header">
<b data-i18n="View / Edit bias preset">View / Edit bias preset</b>
@ -3672,6 +3669,92 @@
<input class="openai_logit_bias_text text_pole" data-i18n="[placeholder]Type here..." placeholder="type here..." />
<input class="openai_logit_bias_value text_pole" type="number" min="-100" value="0" max="100" />
<i class="menu_button fa-solid fa-xmark openai_logit_bias_remove"></i>
</form>
</div>
</div>
</div>
<div id="completion_prompt_manager_popup" class="drawer-content" style="display:none;">
<div id="completion_prompt_manager_popup_inspect">
<h3>Inspect</h3>
<div class="completion_prompt_manager_popup_entry">
<form class="completion_prompt_manager_popup_entry_form">
<div class="completion_prompt_manager_popup_entry_form_control">
<div class="completion_prompt_manager_popup_header">
<label for="completion_prompt_manager_popup_entry_form_prompt">
<span>Prompt List</span>
</label>
<a id="completion_prompt_manager_popup_close_button" title="close" class="fa-solid fa-close menu_button"></a>
</div>
<div class="text_muted">The list of prompts associated with this marker.</div>
<div id="completion_prompt_manager_popup_entry_form_inspect_list"></div>
</div>
</form>
</div>
</div>
<div id="completion_prompt_manager_popup_edit">
<h3>Edit</h3>
<div class="completion_prompt_manager_popup_entry">
<form class="completion_prompt_manager_popup_entry_form">
<div class="completion_prompt_manager_popup_entry_form_control">
<label for="completion_prompt_manager_popup_entry_form_name">
<span>Name</span>
</label>
<div class="text_muted">A name for this prompt.</div>
<input id="completion_prompt_manager_popup_entry_form_name" class="text_pole" type="text" name="name" />
</div>
<div class="completion_prompt_manager_popup_entry_form_control">
<label for="completion_prompt_manager_popup_entry_form_role">
<span>Role</span>
</label>
<div class="text_muted">To whom this message will be attributed.</div>
<select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role">
<option value="system">System</option>
<option value="user">User</option>
<option value="assistant">AI Assistant</option>
</select>
</div>
<div class="completion_prompt_manager_popup_entry_form_control">
<label for="completion_prompt_manager_popup_entry_form_prompt">
<span>Prompt</span>
</label>
<div class="text_muted">The prompt to be sent.</div>
<textarea id="completion_prompt_manager_popup_entry_form_prompt" class="text_pole" name="prompt">
</textarea>
</div>
<div class="completion_prompt_manager_popup_entry_form_footer" >
<a id="completion_prompt_manager_popup_entry_form_close" title="close" class="fa-solid fa-close menu_button"></a>
<a id="completion_prompt_manager_popup_entry_form_reset" title="reset" class="fa-solid fa-undo menu_button"></a>
<a id="completion_prompt_manager_popup_entry_form_save" title="save" class="fa-solid fa-save menu_button" data-pm-prompt=""></a>
</div>
</form>
</div>
</div>
</div>
<div id="shadow_select_chat_popup">
<div id="select_chat_popup">
<div id="select_chat_import"> <!-- import chat popup header -->
<div id="chat_import_button" class="fa-solid fa-file-arrow-up menu_button"></div>
<div id="selectChatPopupHeaderText" class="TxtLrgBoldCenter">
<span id="ChatHistoryCharName"></span>
<br>
Chat History
<a href="/notes/10" class="notes-link" target="_blank"><span class="note-link-span">?</span></a>
</div>
<form id="form_import_chat" action="javascript:void(null);" method="post" enctype="multipart/form-data" style="display: none;">
<input type="file" id="chat_import_file" accept=".json, .jsonl" name="avatar">
<input id="chat_import_file_type" name="file_type" class="text_pole" maxlength="999" size="2" value="" autocomplete="off" style="display: none;">
<input id="chat_import_avatar_url" name="avatar_url" class="text_pole" maxlength="999" size="2" value="" autocomplete="off" style="display: none;">
<input id="chat_import_character_name" name="character_name" class="text_pole" maxlength="999" size="2" value="" autocomplete="off" style="display: none;">
</form>
<div id="select_chat_cross" class="fa-solid fa-circle-xmark" alt="Close Past Chat Popup"></div>
</div>
<div id="select_chat_div">
</div>
<div id="load_select_chat_div">
<div class="fa-solid fa-hourglass fa-spin"></div>
</div>
</div>
</div>

View File

@ -79,6 +79,7 @@ import {
import {
setOpenAIMessageExamples,
setOpenAIMessages,
setupChatCompletionPromptManager,
prepareOpenAIMessages,
sendOpenAIRequest,
loadOpenAISettings,
@ -160,6 +161,7 @@ import { context_settings, loadContextTemplatesFromSettings } from "./scripts/co
import { markdownExclusionExt } from "./scripts/showdown-exclusion.js";
import { NOTE_MODULE_NAME, metadata_keys, setFloatingPrompt, shouldWIAddPrompt } from "./scripts/authors-note.js";
import { deviceInfo } from "./scripts/RossAscends-mods.js";
import { registerPromptManagerMigration } from "./scripts/PromptManager.js";
import { getRegexedString, regex_placement } from "./scripts/extensions/regex/engine.js";
//exporting functions and vars for mods
@ -253,6 +255,14 @@ export const event_types = {
SETTINGS_UPDATED: 'settings_updated',
GROUP_UPDATED: 'group_updated',
MOVABLE_PANELS_RESET: 'movable_panels_reset',
SETTINGS_LOADED_BEFORE: 'settings_loaded_before',
SETTINGS_LOADED_AFTER: 'settings_loaded_after',
CHATCOMPLETION_SOURCE_CHANGED: 'chatcompletion_source_changed',
CHATCOMPLETION_MODEL_CHANGED: 'chatcompletion_model_changed',
OAI_BEFORE_CHATCOMPLETION: 'oai_before_chatcompletion',
OAI_PRESET_CHANGED: 'oai_preset_changed',
WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
CHARACTER_EDITED: 'character_edited',
}
export const eventSource = new EventEmitter();
@ -531,6 +541,9 @@ this
},
};
// Register configuration migrations
registerPromptManagerMigration();
$(document).ajaxError(function myErrorHandler(_, xhr) {
if (xhr.status == 403) {
toastr.warning(
@ -1631,9 +1644,11 @@ function scrollChatToBottom() {
}
}
function substituteParams(content, _name1, _name2, _original) {
function substituteParams(content, _name1, _name2, _original, _group) {
_name1 = _name1 ?? name1;
_name2 = _name2 ?? name2;
_original = _original || '';
_group = _group ?? name2;
if (!content) {
return '';
@ -1648,8 +1663,14 @@ function substituteParams(content, _name1, _name2, _original) {
content = content.replace(/{{input}}/gi, $('#send_textarea').val());
content = content.replace(/{{user}}/gi, _name1);
content = content.replace(/{{char}}/gi, _name2);
content = content.replace(/{{charIfNotGroup}}/gi, _group);
content = content.replace(/{{group}}/gi, _group);
content = content.replace(/<USER>/gi, _name1);
content = content.replace(/<BOT>/gi, _name2);
content = content.replace(/<CHARIFNOTGROUP>/gi, _group);
content = content.replace(/<GROUP>/gi, _group);
content = content.replace(/{{time}}/gi, moment().format('LT'));
content = content.replace(/{{date}}/gi, moment().format('LL'));
content = content.replace(/{{idle_duration}}/gi, () => getTimeSinceLastMessage());
@ -2216,7 +2237,7 @@ class StreamingProcessor {
}
}
async function Generate(type, { automatic_trigger, force_name2, resolve, reject, quiet_prompt, force_chid, signal } = {}) {
async function Generate(type, { automatic_trigger, force_name2, resolve, reject, quiet_prompt, force_chid, signal } = {}, dryRun = false) {
//console.log('Generate entered');
setGenerationProgress(0);
tokens_already_generated = 0;
@ -2288,12 +2309,32 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
reject = () => { };
}
if (selected_group && !is_group_generating) {
if (selected_group && !is_group_generating && !dryRun) {
generateGroupWrapper(false, type, { resolve, reject, quiet_prompt, force_chid, signal: abortController.signal });
return;
} else if (selected_group && !is_group_generating && dryRun) {
const characterIndexMap = new Map(characters.map((char, index) => [char.avatar, index]));
const group = groups.find((x) => x.id === selected_group);
const enabledMembers = group.members.reduce((acc, member) => {
if (!group.disabled_members.includes(member) && !acc.includes(member)) {
acc.push(member);
}
return acc;
}, []);
const memberIds = enabledMembers
.map((member) => characterIndexMap.get(member))
.filter((index) => index !== undefined);
if (memberIds.length > 0) {
setCharacterId(memberIds[0]);
setCharacterName('');
}
}
if (online_status != 'no_connection' && this_chid != undefined && this_chid !== 'invalid-safety-id') {
if (true === dryRun ||
(online_status != 'no_connection' && this_chid != undefined && this_chid !== 'invalid-safety-id')) {
let textareaText;
if (type !== 'regenerate' && type !== "swipe" && type !== 'quiet' && !isImpersonate) {
is_send_press = true;
@ -2785,19 +2826,20 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
generate_data = getNovelGenerationData(finalPromt, this_settings, this_amount_gen, isImpersonate);
}
else if (main_api == 'openai') {
let [prompt, counts] = await prepareOpenAIMessages({
systemPrompt: systemPrompt,
let [prompt, counts] = prepareOpenAIMessages({
name2: name2,
storyString: storyString,
charDescription: charDescription,
charPersonality: charPersonality,
Scenario: Scenario,
worldInfoBefore: worldInfoBefore,
worldInfoAfter: worldInfoAfter,
extensionPrompt: afterScenarioAnchor,
extensionPrompts: extension_prompts,
bias: promptBias,
type: type,
quietPrompt: quiet_prompt,
jailbreakPrompt: jailbreakPrompt,
cyclePrompt: cyclePrompt,
});
}, dryRun);
generate_data = { prompt: prompt };
// counts will return false if the user has not enabled the token breakdown feature
@ -2808,6 +2850,8 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
setInContextMessages(openai_messages_count, type);
}
if (true === dryRun) return onSuccess({error: 'dryRun'});
if (power_user.console_log_prompts) {
console.log(generate_data.prompt);
@ -3207,14 +3251,14 @@ function parseTokenCounts(counts, thisPromptBits) {
const total = Object.values(counts).filter(x => !Number.isNaN(x)).reduce((acc, val) => acc + val, 0);
thisPromptBits.push({
oaiStartTokens: Object.entries(counts)[0][1],
oaiPromptTokens: Object.entries(counts)[1][1],
oaiBiasTokens: Object.entries(counts)[2][1],
oaiNudgeTokens: Object.entries(counts)[3][1],
oaiJailbreakTokens: Object.entries(counts)[4][1],
oaiImpersonateTokens: Object.entries(counts)[5][1],
oaiExamplesTokens: Object.entries(counts)[6][1],
oaiConversationTokens: Object.entries(counts)[7][1],
oaiStartTokens: Object.entries(counts)?.[0]?.[1] ?? 0,
oaiPromptTokens: Object.entries(counts)?.[1]?.[1] ?? 0,
oaiBiasTokens: Object.entries(counts)?.[2]?.[1] ?? 0,
oaiNudgeTokens: Object.entries(counts)?.[3]?.[1] ?? 0,
oaiJailbreakTokens: Object.entries(counts)?.[4]?.[1] ?? 0,
oaiImpersonateTokens: Object.entries(counts)?.[5]?.[1] ?? 0,
oaiExamplesTokens: Object.entries(counts)?.[6]?.[1] ?? 0,
oaiConversationTokens: Object.entries(counts)?.[7]?.[1] ?? 0,
oaiTotalTokens: total,
});
}
@ -4356,6 +4400,7 @@ async function getChat() {
}
await getChatResult();
await saveChat();
eventSource.emit('chatLoaded', {detail: {id: this_chid, character: characters[this_chid]}});
setTimeout(function () {
@ -4515,6 +4560,17 @@ function changeMainAPI() {
getStatus();
getHordeModels();
}
switch (oai_settings.chat_completion_source) {
case chat_completion_sources.SCALE:
case chat_completion_sources.OPENROUTER:
case chat_completion_sources.WINDOWAI:
case chat_completion_sources.CLAUDE:
case chat_completion_sources.OPENAI:
default:
setupChatCompletionPromptManager(oai_settings);
break;
}
}
////////////////////////////////////////////////////
@ -5033,6 +5089,9 @@ async function getSettings(type) {
$("#your_name").val(name1);
}
// Allow subscribers to mutate settings
eventSource.emit(event_types.SETTINGS_LOADED_BEFORE, settings);
//Load KoboldAI settings
koboldai_setting_names = data.koboldai_setting_names;
koboldai_settings = data.koboldai_settings;
@ -5120,6 +5179,9 @@ async function getSettings(type) {
// Load context templates
loadContextTemplatesFromSettings(data, settings);
// Allow subscribers to mutate settings
eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings);
// Set context size after loading power user (may override the max value)
$("#max_context").val(max_context);
$("#max_context_counter").text(`${max_context}`);
@ -6477,6 +6539,7 @@ async function createOrEditCharacter(e) {
);
$("#create_button").attr("value", "Save");
crop_data = undefined;
eventSource.emit(event_types.CHARACTER_EDITED, {detail: {id: this_chid, character: characters[this_chid]}});
},
error: function (jqXHR, exception) {
$("#create_button").removeAttr("disabled");
@ -7520,6 +7583,7 @@ $(document).ready(function () {
if (popup_type == "del_ch") {
const deleteChats = !!$("#del_char_checkbox").prop("checked");
await handleDeleteCharacter(popup_type, this_chid, deleteChats);
eventSource.emit('characterDeleted', {id: this_chid, character: characters[this_chid]});
}
if (popup_type == "alternate_greeting" && menu_type !== "create") {
createOrEditCharacter();
@ -7989,7 +8053,7 @@ $(document).ready(function () {
is_delete_mode = false;
});
//confirms message delation with the "ok" button
//confirms message deletion with the "ok" button
$("#dialogue_del_mes_ok").click(function () {
$("#dialogue_del_mes").css("display", "none");
$("#send_form").css("display", css_send_form_display);
@ -8389,6 +8453,8 @@ $(document).ready(function () {
updateViewMessageIds();
saveChatConditional();
eventSource.emit(event_types.MESSAGE_DELETED, count_view_mes);
hideSwipeButtons();
showSwipeButtons();
});

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ import {
menu_type,
max_context,
saveSettingsDebounced,
eventSource,
active_group,
active_character,
setActiveGroup,
@ -749,7 +750,6 @@ export function dragElement(elmnt) {
observer.disconnect()
console.debug(`Saving ${elmntName} UI position`)
saveSettingsDebounced();
}
}

View File

@ -1166,6 +1166,8 @@ function select_group_chats(groupId, skipAnimation) {
sortGroupMembers("#rm_group_add_members .group_member");
await eventSource.emit(event_types.GROUP_UPDATED);
});
eventSource.emit('groupSelected', {detail: {id: groupId, group: group}});
}
function updateFavButtonState(state) {

View File

@ -1,11 +1,249 @@
/*!
* jQuery UI Touch Punch 0.2.3
* jQuery UI Touch Punch 1.0.9 as modified by RWAP Software
* based on original touchpunch v0.2.3 which has not been updated since 2014
*
* Updates by RWAP Software to take account of various suggested changes on the original code issues
*
* Original: https://github.com/furf/jquery-ui-touch-punch
* Copyright 20112014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Fork: https://github.com/RWAP/jquery-ui-touch-punch
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "jquery", "jquery-ui" ], factory );
} else {
// Browser globals
factory( jQuery );
}
}(function ($) {
// Detect touch support - Windows Surface devices and other touch devices
$.mspointer = window.navigator.msPointerEnabled;
$.touch = ( 'ontouchstart' in document
|| 'ontouchstart' in window
|| window.TouchEvent
|| (window.DocumentTouch && document instanceof DocumentTouch)
|| navigator.maxTouchPoints > 0
|| navigator.msMaxTouchPoints > 0
);
// Ignore browsers without touch or mouse support
if ((!$.touch && !$.mspointer) || !$.ui.mouse) {
return;
}
let mouseProto = $.ui.mouse.prototype,
_mouseInit = mouseProto._mouseInit,
_mouseDestroy = mouseProto._mouseDestroy,
touchHandled;
/**
* Get the x,y position of a touch event
* @param {Object} event A touch event
*/
function getTouchCoords (event) {
return {
x: event.originalEvent.changedTouches[0].pageX,
y: event.originalEvent.changedTouches[0].pageY
};
}
/**
* Simulate a mouse event based on a corresponding touch event
* @param {Object} event A touch event
* @param {String} simulatedType The corresponding mouse event
*/
function simulateMouseEvent (event, simulatedType) {
// Ignore multi-touch events
if (event.originalEvent.touches.length > 1) {
return;
}
//Ignore input or textarea elements so user can still enter text
if ($(event.target).is("input") || $(event.target).is("textarea")) {
return;
}
// Prevent "Ignored attempt to cancel a touchmove event with cancelable=false" errors
if (event.cancelable) {
event.preventDefault();
}
let touch = event.originalEvent.changedTouches[0],
simulatedEvent = document.createEvent('MouseEvents');
// Initialize the simulated mouse event using the touch event's coordinates
simulatedEvent.initMouseEvent(
simulatedType, // type
true, // bubbles
true, // cancelable
window, // view
1, // detail
touch.screenX, // screenX
touch.screenY, // screenY
touch.clientX, // clientX
touch.clientY, // clientY
false, // ctrlKey
false, // altKey
false, // shiftKey
false, // metaKey
0, // button
null // relatedTarget
);
// Dispatch the simulated event to the target element
event.target.dispatchEvent(simulatedEvent);
}
/**
* Handle the jQuery UI widget's touchstart events
* @param {Object} event The widget element's touchstart event
*/
mouseProto._touchStart = function (event) {
let self = this;
// Interaction time
this._startedMove = event.timeStamp;
// Track movement to determine if interaction was a click
self._startPos = getTouchCoords(event);
// Ignore the event if another widget is already being handled
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
return;
}
// Set the flag to prevent other widgets from inheriting the touch event
touchHandled = true;
// Track movement to determine if interaction was a click
self._touchMoved = false;
// Simulate the mouseover event
simulateMouseEvent(event, 'mouseover');
// Simulate the mousemove event
simulateMouseEvent(event, 'mousemove');
// Simulate the mousedown event
simulateMouseEvent(event, 'mousedown');
};
/**
* Handle the jQuery UI widget's touchmove events
* @param {Object} event The document's touchmove event
*/
mouseProto._touchMove = function (event) {
// Ignore event if not handled
if (!touchHandled) {
return;
}
// Interaction was moved
this._touchMoved = true;
// Simulate the mousemove event
simulateMouseEvent(event, 'mousemove');
};
/**
* Handle the jQuery UI widget's touchend events
* @param {Object} event The document's touchend event
*/
mouseProto._touchEnd = function (event) {
// Ignore event if not handled
if (!touchHandled) {
return;
}
// Simulate the mouseup event
simulateMouseEvent(event, 'mouseup');
// Simulate the mouseout event
simulateMouseEvent(event, 'mouseout');
// If the touch interaction did not move, it should trigger a click
// Check for this in two ways - length of time of simulation and distance moved
// Allow for Apple Stylus to be used also
let timeMoving = event.timeStamp - this._startedMove;
if (!this._touchMoved || timeMoving < 500) {
// Simulate the click event
simulateMouseEvent(event, 'click');
} else {
let endPos = getTouchCoords(event);
if ((Math.abs(endPos.x - this._startPos.x) < 10) && (Math.abs(endPos.y - this._startPos.y) < 10)) {
// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved || event.originalEvent.changedTouches[0].touchType === 'stylus') {
// Simulate the click event
simulateMouseEvent(event, 'click');
}
}
}
// Unset the flag to determine the touch movement stopped
this._touchMoved = false;
// Unset the flag to allow other widgets to inherit the touch event
touchHandled = false;
};
/**
* A duck punch of the $.ui.mouse _mouseInit method to support touch events.
* This method extends the widget with bound touch event handlers that
* translate touch events to mouse events and pass them to the widget's
* original mouse event handling methods.
*/
mouseProto._mouseInit = function () {
let self = this;
// Microsoft Surface Support = remove original touch Action
if ($.support.mspointer) {
self.element[0].style.msTouchAction = 'none';
}
// Delegate the touch handlers to the widget's element
self.element.on({
touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd')
});
// Call the original $.ui.mouse init method
_mouseInit.call(self);
};
/**
* Remove the touch event handlers
*/
mouseProto._mouseDestroy = function () {
let self = this;
// Delegate the touch handlers to the widget's element
self.element.off({
touchstart: $.proxy(self, '_touchStart'),
touchmove: $.proxy(self, '_touchMove'),
touchend: $.proxy(self, '_touchEnd')
});
// Call the original $.ui.mouse destroy method
_mouseDestroy.call(self);
};
}));

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type } from "../script.js";
import { saveSettings, callPopup, substituteParams, getTokenCount, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types } from "../script.js";
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, delay, getCharaFilename, deepClone } from "./utils.js";
import { getContext } from "./extensions.js";
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
@ -1369,6 +1369,7 @@ function onWorldInfoChange(_, text) {
}
saveSettingsDebounced();
eventSource.emit(event_types.WORLDINFO_SETTINGS_UPDATED);
}
export async function importWorldInfo(file) {
@ -1505,36 +1506,41 @@ jQuery(() => {
}
});
const saveSettings = () => {
saveSettingsDebounced()
eventSource.emit(event_types.WORLDINFO_SETTINGS_UPDATED);
}
$(document).on("input", "#world_info_depth", function () {
world_info_depth = Number($(this).val());
$("#world_info_depth_counter").text($(this).val());
saveSettingsDebounced();
saveSettings();
});
$(document).on("input", "#world_info_budget", function () {
world_info_budget = Number($(this).val());
$("#world_info_budget_counter").text($(this).val());
saveSettingsDebounced();
saveSettings();
});
$(document).on("input", "#world_info_recursive", function () {
world_info_recursive = !!$(this).prop('checked');
saveSettingsDebounced();
saveSettings();
})
$('#world_info_case_sensitive').on('input', function () {
world_info_case_sensitive = !!$(this).prop('checked');
saveSettingsDebounced();
saveSettings();
})
$('#world_info_match_whole_words').on('input', function () {
world_info_match_whole_words = !!$(this).prop('checked');
saveSettingsDebounced();
saveSettings();
});
$('#world_info_character_strategy').on('change', function () {
world_info_character_strategy = $(this).val();
saveSettingsDebounced();
saveSettings();
});
$('#world_info_overflow_alert').on('change', function () {

View File

@ -1,5 +1,7 @@
@charset "UTF-8";
@import url(css/promptmanager.css);
:root {
--doc-height: 100%;
--transparent: rgba(0, 0, 0, 0);
@ -11,6 +13,7 @@
--black90a: rgba(0, 0, 0, 0.9);
--black100: rgba(0, 0, 0, 1);
--white20a: rgba(255, 255, 255, 0.2);
--white30a: rgba(255, 255, 255, 0.3);
--white50a: rgba(255, 255, 255, 0.5);
--white60a: rgba(255, 255, 255, 0.6);
@ -188,6 +191,11 @@ table.responsiveTable {
text-align: center;
}
.text_muted {
font-size: calc(var(--mainFontSize) - 0.2rem);
color: var(--white50a);
}
.mes_text table {
border-spacing: 0;
border-collapse: collapse;
@ -200,6 +208,58 @@ table.responsiveTable {
padding: 0.25em;
}
.text_warning {
color: rgb(220 173 16);
}
.text_danger {
color: var(--fullred);
}
.m-t-1 {
margin-top: 1em;
}
.m-t-2 {
margin-top: 2em;
}
.m-t-3 {
margin-top: 3em;
}
.m-t-4 {
margin-top: 4em;
}
.m-t-5 {
margin-top: 5em;
}
.m-b-1 {
margin-bottom: 1em;
}
.m-b-2 {
margin-bottom: 2em;
}
.m-b-3 {
margin-bottom: 3em;
}
.m-b-4 {
margin-bottom: 4em;
}
.m-b-5 {
margin-bottom: 5em;
}
.tooltip {
cursor: help;
}
.mes_text p {
margin-top: 0;
margin-bottom: 10px;
@ -4267,7 +4327,6 @@ input.extension_missing[type="checkbox"] {
margin: 0;
left: 0;
right: auto;
padding: 5px;
border-radius: 10px;
box-shadow: none;
overflow: hidden;
@ -4279,6 +4338,10 @@ input.extension_missing[type="checkbox"] {
height: calc(100% - 30px);
}
.fillLeft .scrollableInner {
padding: 0.5em 1em 0.5em 0.5em
}
.width100p {
width: 100%;
}
@ -5348,6 +5411,7 @@ body.waifuMode .zoomed_avatar {
}
}
/* Customize the Select2 container */
.select2-container {
color: var(--SmartThemeBodyColor);
@ -5482,3 +5546,5 @@ body.waifuMode .zoomed_avatar {
text-align: center;
line-height: 14px;
}