Merge branch 'staging' of https://github.com/city-unit/SillyTavern into feature/ui
This commit is contained in:
commit
f528791c4f
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"temp": 0,
|
||||
"rep_pen": 1.1,
|
||||
"rep_pen": 1.18,
|
||||
"rep_pen_range": 2048,
|
||||
"streaming_kobold": true,
|
||||
"top_p": 0,
|
||||
|
@ -8,7 +8,7 @@
|
|||
"top_k": 1,
|
||||
"typical": 1,
|
||||
"tfs": 1,
|
||||
"rep_pen_slope": 0.2,
|
||||
"rep_pen_slope": 0,
|
||||
"single_line": false,
|
||||
"sampler_order": [
|
||||
6,
|
||||
|
|
|
@ -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.",
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"temp": 1,
|
||||
"top_p": 1,
|
||||
"top_k": 50,
|
||||
"temp": 0,
|
||||
"top_p": 0,
|
||||
"top_k": 1,
|
||||
"typical_p": 1,
|
||||
"top_a": 0,
|
||||
"tfs": 1,
|
||||
"epsilon_cutoff": 0,
|
||||
"eta_cutoff": 0,
|
||||
"rep_pen": 1,
|
||||
"rep_pen": 1.18,
|
||||
"rep_pen_range": 0,
|
||||
"no_repeat_ngram_size": 0,
|
||||
"penalty_alpha": 0,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -434,7 +434,7 @@
|
|||
</div>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="temp_textgenerationwebui" name="volume" min="0.1" max="2.0" step="0.01">
|
||||
<input type="range" id="temp_textgenerationwebui" name="volume" min="0.0" max="2.0" step="0.01">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="temp_textgenerationwebui" id="temp_counter_textgenerationwebui">
|
||||
|
@ -864,6 +864,34 @@
|
|||
<textarea id="nai_preamble_textarea" class="text_pole textarea_compact" name="nai_preamble" rows="2" placeholder=""></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title justifyLeft" data-i18n="CFG Scale">
|
||||
CFG Scale
|
||||
</div>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="cfg_scale_novel" name="volume" min="1" max="3" step="0.05">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="cfg_scale_novel" id="cfg_scale_counter_novel">
|
||||
select
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title justifyLeft">
|
||||
<span data-i18n="Negative Prompt">Negative Prompt</span>
|
||||
</div>
|
||||
<div class="wide100p">
|
||||
<textarea id="nai_cfg_uc" class="text_pole textarea_compact" name="cfg_uc" rows="2" data-i18n="[placeholder]Add text here that would make the AI generate things you don't want in your outputs." placeholder="Add text here that would make the AI generate things you don't want in your outputs."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<small class="margin-bot-10px" data-i18n="Used if CFG Scale is unset globally, per chat or character">
|
||||
Used if CFG Scale is unset globally, per chat or character
|
||||
</small>
|
||||
<hr>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title" data-i18n="Top P">
|
||||
Top P
|
||||
|
@ -969,21 +997,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title" data-i18n="CFG Scale">
|
||||
CFG Scale
|
||||
</div>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="cfg_scale_novel" name="volume" min="1" max="3" step="0.05">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="cfg_scale_novel" id="cfg_scale_counter_novel">
|
||||
select
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="range-block">
|
||||
<div class="range-block-title" data-i18n="Phrase Repetition Penalty">
|
||||
Phrase Repetition Penalty
|
||||
|
@ -1272,41 +1285,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 +1298,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 +1310,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 +1492,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>
|
||||
|
@ -3677,6 +3687,65 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"input_sequence": "### Instruction:",
|
||||
"macro": true,
|
||||
"name": "Roleplay",
|
||||
"names": false,
|
||||
"names": true,
|
||||
"output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
|
||||
"separator_sequence": "",
|
||||
"stop_sequence": "",
|
||||
|
|
106
public/script.js
106
public/script.js
|
@ -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(
|
||||
|
@ -1669,9 +1682,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 '';
|
||||
|
@ -1686,8 +1701,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());
|
||||
|
@ -2254,7 +2275,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;
|
||||
|
@ -2326,14 +2347,34 @@ 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) {
|
||||
if (type !== 'regenerate' && type !== "swipe" && type !== 'quiet' && !isImpersonate && !dryRun) {
|
||||
is_send_press = true;
|
||||
textareaText = $("#send_textarea").val();
|
||||
$("#send_textarea").val('').trigger('input');
|
||||
|
@ -2342,7 +2383,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||
if (chat.length && chat[chat.length - 1]['is_user']) {
|
||||
//do nothing? why does this check exist?
|
||||
}
|
||||
else if (type !== 'quiet' && type !== "swipe" && !isImpersonate) {
|
||||
else if (type !== 'quiet' && type !== "swipe" && !isImpersonate && !dryRun) {
|
||||
chat.length = chat.length - 1;
|
||||
count_view_mes -= 1;
|
||||
$('#chat').children().last().hide(500, function () {
|
||||
|
@ -2823,19 +2864,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
|
||||
|
@ -2846,6 +2888,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);
|
||||
|
@ -3245,14 +3289,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,
|
||||
});
|
||||
}
|
||||
|
@ -4394,6 +4438,7 @@ async function getChat() {
|
|||
}
|
||||
await getChatResult();
|
||||
await saveChat();
|
||||
eventSource.emit('chatLoaded', {detail: {id: this_chid, character: characters[this_chid]}});
|
||||
|
||||
|
||||
setTimeout(function () {
|
||||
|
@ -4553,6 +4598,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;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -5071,6 +5127,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;
|
||||
|
@ -5158,6 +5217,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}`);
|
||||
|
@ -6515,6 +6577,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");
|
||||
|
@ -7558,6 +7621,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();
|
||||
|
@ -8027,7 +8091,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);
|
||||
|
@ -8427,6 +8491,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
|
@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1090,7 +1090,11 @@ $("document").ready(function () {
|
|||
}
|
||||
|
||||
if (event.key == "Escape") { //closes various panels
|
||||
if ($("#curEditTextarea").is(":visible")) {
|
||||
//dont override Escape hotkey functions from script.js
|
||||
//"close edit box" and "cancel stream generation".
|
||||
|
||||
if ($("#curEditTextarea").is(":visible") || $("#mes_stop").is(":visible")) {
|
||||
console.debug('escape key, but deferring to script.js routines')
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -1103,10 +1107,12 @@ $("document").ready(function () {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ($("#select_chat_popup").is(":visible")) {
|
||||
$("#select_chat_cross").trigger('click');
|
||||
return
|
||||
}
|
||||
|
||||
if ($("#character_popup").is(":visible")) {
|
||||
$("#character_cross").trigger('click');
|
||||
return
|
||||
|
@ -1116,28 +1122,37 @@ $("document").ready(function () {
|
|||
.not('#WorldInfo')
|
||||
.not('#left-nav-panel')
|
||||
.not('#right-nav-panel')
|
||||
.not('#floatingPrompt')
|
||||
.is(":visible")) {
|
||||
let visibleDrawerContent = $(".drawer-content:visible")
|
||||
.not('#WorldInfo')
|
||||
.not('#left-nav-panel')
|
||||
.not('#right-nav-panel')
|
||||
.not('#floatingPrompt')
|
||||
console.log(visibleDrawerContent)
|
||||
$(visibleDrawerContent).parent().find('.drawer-icon').trigger('click');
|
||||
return
|
||||
}
|
||||
|
||||
if ($("#floatingPrompt").is(":visible")) {
|
||||
console.log('saw AN visible, trying to close')
|
||||
$("#ANClose").trigger('click');
|
||||
return
|
||||
}
|
||||
|
||||
if ($("#WorldInfo").is(":visible")) {
|
||||
$("#WIDrawerIcon").trigger('click');
|
||||
return
|
||||
}
|
||||
if ($("#left-nav-panel").is(":visible")) {
|
||||
|
||||
if ($("#left-nav-panel").is(":visible") &&
|
||||
$(LPanelPin).prop('checked') === false) {
|
||||
$("#leftNavDrawerIcon").trigger('click');
|
||||
return
|
||||
}
|
||||
if ($("#right-nav-panel").is(":visible")) {
|
||||
|
||||
if ($("#right-nav-panel").is(":visible") &&
|
||||
$(RPanelPin).prop('checked') === false) {
|
||||
$("#rightNavDrawerIcon").trigger('click');
|
||||
return
|
||||
}
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
import {
|
||||
chat_metadata,
|
||||
eventSource,
|
||||
event_types,
|
||||
saveSettingsDebounced,
|
||||
this_chid,
|
||||
} from "../../../script.js";
|
||||
import { selected_group } from "../../group-chats.js";
|
||||
import { extension_settings, saveMetadataDebounced } from "../../extensions.js";
|
||||
import { getCharaFilename, delay } from "../../utils.js";
|
||||
import { power_user } from "../../power-user.js";
|
||||
import { metadataKeys } from "./util.js";
|
||||
|
||||
// Keep track of where your extension is located, name should match repo name
|
||||
const extensionName = "cfg";
|
||||
const extensionFolderPath = `scripts/extensions/${extensionName}`;
|
||||
const defaultSettings = {
|
||||
global: {
|
||||
"guidance_scale": 1,
|
||||
"negative_prompt": ''
|
||||
},
|
||||
chara: []
|
||||
};
|
||||
const settingType = {
|
||||
guidance_scale: 0,
|
||||
negative_prompt: 1
|
||||
}
|
||||
|
||||
// Used for character and chat CFG values
|
||||
function updateSettings() {
|
||||
saveSettingsDebounced();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
function setCharCfg(tempValue, setting) {
|
||||
const avatarName = getCharaFilename();
|
||||
|
||||
// Assign temp object
|
||||
let tempCharaCfg;
|
||||
switch(setting) {
|
||||
case settingType.guidance_scale:
|
||||
tempCharaCfg = {
|
||||
"name": avatarName,
|
||||
"guidance_scale": Number(tempValue)
|
||||
}
|
||||
break;
|
||||
case settingType.negative_prompt:
|
||||
tempCharaCfg = {
|
||||
"name": avatarName,
|
||||
"negative_prompt": tempValue
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
let existingCharaCfgIndex;
|
||||
let existingCharaCfg;
|
||||
|
||||
if (extension_settings.cfg.chara) {
|
||||
existingCharaCfgIndex = extension_settings.cfg.chara.findIndex((e) => e.name === avatarName);
|
||||
existingCharaCfg = extension_settings.cfg.chara[existingCharaCfgIndex];
|
||||
}
|
||||
|
||||
if (extension_settings.cfg.chara && existingCharaCfg) {
|
||||
const tempAssign = Object.assign(existingCharaCfg, tempCharaCfg);
|
||||
|
||||
// If both values are default, remove the entry
|
||||
if (!existingCharaCfg.useChara && (tempAssign.guidance_scale ?? 1.00) === 1.00 && (tempAssign.negative_prompt?.length ?? 0) === 0) {
|
||||
extension_settings.cfg.chara.splice(existingCharaCfgIndex, 1);
|
||||
}
|
||||
} else if (avatarName && tempValue.length > 0) {
|
||||
if (!extension_settings.cfg.chara) {
|
||||
extension_settings.cfg.chara = []
|
||||
}
|
||||
|
||||
extension_settings.cfg.chara.push(tempCharaCfg);
|
||||
} else {
|
||||
console.debug("Character CFG error: No avatar name key could be found.");
|
||||
|
||||
// Don't save settings if something went wrong
|
||||
return false;
|
||||
}
|
||||
|
||||
updateSettings();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function setChatCfg(tempValue, setting) {
|
||||
switch(setting) {
|
||||
case settingType.guidance_scale:
|
||||
chat_metadata[metadataKeys.guidance_scale] = tempValue;
|
||||
break;
|
||||
case settingType.negative_prompt:
|
||||
chat_metadata[metadataKeys.negative_prompt] = tempValue;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
saveMetadataDebounced();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Only change CFG when character is selected
|
||||
function onCfgMenuItemClick() {
|
||||
if (selected_group || this_chid) {
|
||||
//show CFG config if it's hidden
|
||||
if ($("#cfgConfig").css("display") !== 'flex') {
|
||||
$("#cfgConfig").addClass('resizing')
|
||||
$("#cfgConfig").css("display", "flex");
|
||||
$("#cfgConfig").css("opacity", 0.0);
|
||||
$("#cfgConfig").transition({
|
||||
opacity: 1.0,
|
||||
duration: 250,
|
||||
}, async function () {
|
||||
await delay(50);
|
||||
$("#cfgConfig").removeClass('resizing')
|
||||
});
|
||||
|
||||
//auto-open the main AN inline drawer
|
||||
if ($("#CFGBlockToggle")
|
||||
.siblings('.inline-drawer-content')
|
||||
.css('display') !== 'block') {
|
||||
$("#floatingPrompt").addClass('resizing')
|
||||
$("#CFGBlockToggle").click();
|
||||
}
|
||||
} else {
|
||||
//hide AN if it's already displayed
|
||||
$("#cfgConfig").addClass('resizing')
|
||||
$("#cfgConfig").transition({
|
||||
opacity: 0.0,
|
||||
duration: 250,
|
||||
},
|
||||
async function () {
|
||||
await delay(50);
|
||||
$("#cfgConfig").removeClass('resizing')
|
||||
});
|
||||
setTimeout(function () {
|
||||
$("#cfgConfig").hide();
|
||||
}, 250);
|
||||
|
||||
}
|
||||
//duplicate options menu close handler from script.js
|
||||
//because this listener takes priority
|
||||
$("#options").stop().fadeOut(250);
|
||||
} else {
|
||||
toastr.warning(`Select a character before trying to configure CFG`, '', { timeOut: 2000 });
|
||||
}
|
||||
}
|
||||
|
||||
async function onChatChanged() {
|
||||
loadSettings();
|
||||
await modifyCharaHtml();
|
||||
}
|
||||
|
||||
// Rearrange the panel if a group chat is present
|
||||
async function modifyCharaHtml() {
|
||||
if (selected_group) {
|
||||
$("#chara_cfg_container").hide();
|
||||
$("#groupchat_cfg_use_chara_container").show();
|
||||
} else {
|
||||
$("#chara_cfg_container").show();
|
||||
$("#groupchat_cfg_use_chara_container").hide();
|
||||
// TODO: Remove chat checkbox here
|
||||
}
|
||||
}
|
||||
|
||||
// Reloads chat-specific settings
|
||||
function loadSettings() {
|
||||
// Set chat CFG if it exists
|
||||
$('#chat_cfg_guidance_scale').val(chat_metadata[metadataKeys.guidance_scale] ?? 1.0.toFixed(2));
|
||||
$('#chat_cfg_guidance_scale_counter').text(chat_metadata[metadataKeys.guidance_scale]?.toFixed(2) ?? 1.0.toFixed(2));
|
||||
$('#chat_cfg_negative_prompt').val(chat_metadata[metadataKeys.negative_prompt] ?? '');
|
||||
$('#groupchat_cfg_use_chara').prop('checked', chat_metadata[metadataKeys.groupchat_individual_chars] ?? false);
|
||||
if (chat_metadata[metadataKeys.negative_combine]?.length > 0) {
|
||||
chat_metadata[metadataKeys.negative_combine].forEach((element) => {
|
||||
$(`input[name="cfg_negative_combine"][value="${element}"]`)
|
||||
.prop("checked", true);
|
||||
});
|
||||
}
|
||||
|
||||
// Set character CFG if it exists
|
||||
if (!selected_group) {
|
||||
const charaCfg = extension_settings.cfg.chara.find((e) => e.name === getCharaFilename());
|
||||
$('#chara_cfg_guidance_scale').val(charaCfg?.guidance_scale ?? 1.00);
|
||||
$('#chara_cfg_guidance_scale_counter').text(charaCfg?.guidance_scale?.toFixed(2) ?? 1.0.toFixed(2));
|
||||
$('#chara_cfg_negative_prompt').val(charaCfg?.negative_prompt ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
// Load initial extension settings
|
||||
async function initialLoadSettings() {
|
||||
// Create the settings if they don't exist
|
||||
extension_settings[extensionName] = extension_settings[extensionName] || {};
|
||||
if (Object.keys(extension_settings[extensionName]).length === 0) {
|
||||
Object.assign(extension_settings[extensionName], defaultSettings);
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
// Set global CFG values on load
|
||||
$('#global_cfg_guidance_scale').val(extension_settings.cfg.global.guidance_scale);
|
||||
$('#global_cfg_guidance_scale_counter').text(extension_settings.cfg.global.guidance_scale.toFixed(2));
|
||||
$('#global_cfg_negative_prompt').val(extension_settings.cfg.global.negative_prompt);
|
||||
}
|
||||
|
||||
function migrateSettings() {
|
||||
let performSave = false;
|
||||
|
||||
if (power_user.guidance_scale) {
|
||||
extension_settings.cfg.global.guidance_scale = power_user.guidance_scale;
|
||||
delete power_user['guidance_scale'];
|
||||
performSave = true;
|
||||
}
|
||||
|
||||
if (power_user.negative_prompt) {
|
||||
extension_settings.cfg.global.negative_prompt = power_user.negative_prompt;
|
||||
delete power_user['negative_prompt'];
|
||||
performSave = true;
|
||||
}
|
||||
|
||||
if (performSave) {
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
}
|
||||
|
||||
// This function is called when the extension is loaded
|
||||
jQuery(async () => {
|
||||
// This is an example of loading HTML from a file
|
||||
const windowHtml = $(await $.get(`${extensionFolderPath}/window.html`));
|
||||
|
||||
// Append settingsHtml to extensions_settings
|
||||
// extension_settings and extensions_settings2 are the left and right columns of the settings menu
|
||||
// Left should be extensions that deal with system functions and right should be visual/UI related
|
||||
windowHtml.find('#CFGClose').on('click', function () {
|
||||
$("#cfgConfig").transition({
|
||||
opacity: 0,
|
||||
duration: 200,
|
||||
easing: 'ease-in-out',
|
||||
});
|
||||
setTimeout(function () { $('#cfgConfig').hide() }, 200);
|
||||
});
|
||||
|
||||
windowHtml.find('#chat_cfg_guidance_scale').on('input', function() {
|
||||
const numberValue = Number($(this).val());
|
||||
const success = setChatCfg(numberValue, settingType.guidance_scale);
|
||||
if (success) {
|
||||
$('#chat_cfg_guidance_scale_counter').text(numberValue.toFixed(2));
|
||||
}
|
||||
});
|
||||
|
||||
windowHtml.find('#chat_cfg_negative_prompt').on('input', function() {
|
||||
setChatCfg($(this).val(), settingType.negative_prompt);
|
||||
});
|
||||
|
||||
windowHtml.find('#chara_cfg_guidance_scale').on('input', function() {
|
||||
const value = $(this).val();
|
||||
const success = setCharCfg(value, settingType.guidance_scale);
|
||||
if (success) {
|
||||
$('#chara_cfg_guidance_scale_counter').text(Number(value).toFixed(2));
|
||||
}
|
||||
});
|
||||
|
||||
windowHtml.find('#chara_cfg_negative_prompt').on('input', function() {
|
||||
setCharCfg($(this).val(), settingType.negative_prompt);
|
||||
});
|
||||
|
||||
windowHtml.find('#global_cfg_guidance_scale').on('input', function() {
|
||||
extension_settings.cfg.global.guidance_scale = Number($(this).val());
|
||||
$('#global_cfg_guidance_scale_counter').text(extension_settings.cfg.global.guidance_scale.toFixed(2));
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
windowHtml.find('#global_cfg_negative_prompt').on('input', function() {
|
||||
extension_settings.cfg.global.negative_prompt = $(this).val();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
windowHtml.find(`input[name="cfg_negative_combine"]`).on('input', function() {
|
||||
const values = windowHtml.find(`input[name="cfg_negative_combine"]`)
|
||||
.filter(":checked")
|
||||
.map(function() { return parseInt($(this).val()) })
|
||||
.get()
|
||||
.filter((e) => e !== NaN) || [];
|
||||
|
||||
chat_metadata[metadataKeys.negative_combine] = values;
|
||||
saveMetadataDebounced();
|
||||
});
|
||||
|
||||
windowHtml.find('#groupchat_cfg_use_chara').on('input', function() {
|
||||
const checked = !!$(this).prop('checked');
|
||||
chat_metadata[metadataKeys.groupchat_individual_chars] = checked
|
||||
|
||||
if (checked) {
|
||||
toastr.info("You can edit character CFG values in their respective character chats.");
|
||||
}
|
||||
|
||||
saveMetadataDebounced();
|
||||
});
|
||||
|
||||
$("#movingDivs").append(windowHtml);
|
||||
|
||||
initialLoadSettings();
|
||||
|
||||
if (extension_settings.cfg) {
|
||||
migrateSettings();
|
||||
}
|
||||
|
||||
const buttonHtml = $(await $.get(`${extensionFolderPath}/menuButton.html`));
|
||||
buttonHtml.on('click', onCfgMenuItemClick)
|
||||
buttonHtml.insertAfter("#option_toggle_AN");
|
||||
|
||||
// Hook events
|
||||
eventSource.on(event_types.CHAT_CHANGED, async () => {
|
||||
await onChatChanged();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"display_name": "CFG",
|
||||
"loading_order": 1,
|
||||
"requires": [],
|
||||
"optional": [],
|
||||
"js": "index.js",
|
||||
"css": "style.css",
|
||||
"author": "kingbri",
|
||||
"version": "1.0.0",
|
||||
"homePage": "https://github.com/SillyTavern/SillyTavern"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
<a id="option_toggle_CFG">
|
||||
<i class="fa-lg fa-solid fa-scale-balanced"></i>
|
||||
<span data-i18n="CFG Scale">CFG Scale</span>
|
||||
</a>
|
|
@ -0,0 +1,72 @@
|
|||
import { chat_metadata, this_chid } from "../../../script.js";
|
||||
import { extension_settings, getContext } from "../../extensions.js"
|
||||
import { selected_group } from "../../group-chats.js";
|
||||
import { getCharaFilename } from "../../utils.js";
|
||||
|
||||
export const cfgType = {
|
||||
chat: 0,
|
||||
chara: 1,
|
||||
global: 2
|
||||
}
|
||||
export const metadataKeys = {
|
||||
guidance_scale: "cfg_guidance_scale",
|
||||
negative_prompt: "cfg_negative_prompt",
|
||||
negative_combine: "cfg_negative_combine",
|
||||
groupchat_individual_chars: "cfg_groupchat_individual_chars"
|
||||
}
|
||||
|
||||
// Gets the CFG value from hierarchy of chat -> character -> global
|
||||
// Returns undefined values which should be handled in the respective backend APIs
|
||||
export function getCfg() {
|
||||
let splitNegativePrompt = [];
|
||||
const charaCfg = extension_settings.cfg.chara?.find((e) => e.name === getCharaFilename(this_chid));
|
||||
const guidanceScale = getGuidanceScale(charaCfg);
|
||||
const chatNegativeCombine = chat_metadata[metadataKeys.negative_combine] ?? [];
|
||||
|
||||
// If there's a guidance scale, continue. Otherwise assume undefined
|
||||
if (guidanceScale?.value && guidanceScale?.value !== 1) {
|
||||
if (guidanceScale.type === cfgType.chat || chatNegativeCombine.includes(cfgType.chat)) {
|
||||
splitNegativePrompt.push(chat_metadata[metadataKeys.negative_prompt]?.trim());
|
||||
}
|
||||
|
||||
if (guidanceScale.type === cfgType.chara || chatNegativeCombine.includes(cfgType.chara)) {
|
||||
splitNegativePrompt.push(charaCfg.negative_prompt?.trim())
|
||||
}
|
||||
|
||||
if (guidanceScale.type === cfgType.global || chatNegativeCombine.includes(cfgType.global)) {
|
||||
splitNegativePrompt.push(extension_settings.cfg.global.negative_prompt?.trim());
|
||||
}
|
||||
|
||||
const combinedNegatives = splitNegativePrompt.filter((e) => e.length > 0).join(", ");
|
||||
console.debug(`Setting CFG with guidance scale: ${guidanceScale.value}, negatives: ${combinedNegatives}`)
|
||||
|
||||
return {
|
||||
guidanceScale: guidanceScale.value,
|
||||
negativePrompt: combinedNegatives
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the guidance scale is 1, ignore the CFG negative prompt since it won't be used anyways
|
||||
function getGuidanceScale(charaCfg) {
|
||||
const chatGuidanceScale = chat_metadata[metadataKeys.guidance_scale];
|
||||
const groupchatCharOverride = chat_metadata[metadataKeys.groupchat_individual_chars] ?? false;
|
||||
if (chatGuidanceScale && chatGuidanceScale !== 1 && !groupchatCharOverride) {
|
||||
return {
|
||||
type: cfgType.chat,
|
||||
value: chatGuidanceScale
|
||||
};
|
||||
}
|
||||
|
||||
if ((!selected_group && charaCfg || groupchatCharOverride) && charaCfg?.guidance_scale !== 1) {
|
||||
return {
|
||||
type: cfgType.chara,
|
||||
value: charaCfg.guidance_scale
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: cfgType.global,
|
||||
value: extension_settings.cfg.global.guidance_scale
|
||||
};
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
<div id="cfgConfig" class="drawer-content flexGap5">
|
||||
<div class="panelControlBar flex-container">
|
||||
<div id="cfgConfigHeader" class="fa-solid fa-grip drag-grabber"></div>
|
||||
<div id="CFGClose" class="fa-solid fa-circle-xmark"></div>
|
||||
</div>
|
||||
<div name="cfgConfigHolder" class="scrollY">
|
||||
<div id="chat_cfg_container">
|
||||
<div class="inline-drawer">
|
||||
<div id="CFGBlockToggle" class="inline-drawer-toggle inline-drawer-header">
|
||||
<b>Chat CFG</b>
|
||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||
</div>
|
||||
<div class="inline-drawer-content">
|
||||
<small>
|
||||
<b>Unique to this chat.</b><br>
|
||||
</small>
|
||||
<label for="chat_cfg_negative_prompt">
|
||||
<span data-i18n="Scale">Scale</span>
|
||||
</label>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="chat_cfg_guidance_scale" name="volume" min="0.10" max="4.00" step="0.05">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="chat_cfg_guidance_scale" id="chat_cfg_guidance_scale_counter">
|
||||
select
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="chat_cfg_negative_prompt">
|
||||
<span data-i18n="Negative Prompt">Negative Prompt</span>
|
||||
</label>
|
||||
<textarea id="chat_cfg_negative_prompt" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]write short replies, write replies using past tense" placeholder="write short replies, write replies using past tense"></textarea>
|
||||
</div>
|
||||
<div id="groupchat_cfg_use_chara_container">
|
||||
<label class="checkbox_label" for="groupchat_cfg_use_chara">
|
||||
<input type="checkbox" id="groupchat_cfg_use_chara" />
|
||||
<span data-i18n="Use character CFG scales">Use character CFG scales</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="chara_cfg_container" style="display: none;">
|
||||
<hr class="sysHR">
|
||||
<div class="inline-drawer">
|
||||
<div id="charaANBlockToggle" class="inline-drawer-toggle inline-drawer-header">
|
||||
<b>Character CFG</b>
|
||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||
</div>
|
||||
<div class="inline-drawer-content">
|
||||
<small><b>Will be automatically added as the CFG for this character.</b></small>
|
||||
<br />
|
||||
<label for="chara_cfg_negative_prompt">
|
||||
<span data-i18n="Scale">Scale</span>
|
||||
</label>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="chara_cfg_guidance_scale" name="volume" min="0.10" max="4.00" step="0.05">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="chara_cfg_guidance_scale" id="chara_cfg_guidance_scale_counter">
|
||||
select
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="chara_cfg_negative_prompt">
|
||||
<span data-i18n="Negative Prompt">Negative Prompt</span>
|
||||
</label>
|
||||
<textarea id="chara_cfg_negative_prompt" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]write short replies, write replies using past tense" placeholder="write short replies, write replies using past tense"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="global_cfg_container">
|
||||
<hr class="sysHR">
|
||||
<div class="inline-drawer">
|
||||
<div id="defaultANBlockToggle" class="inline-drawer-toggle inline-drawer-header">
|
||||
<b>Global CFG</b>
|
||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||
</div>
|
||||
<div class="inline-drawer-content">
|
||||
<small><b>Will be used as the default CFG options for every chat unless overridden.</b></small>
|
||||
<br />
|
||||
<label for="global_cfg_negative_prompt">
|
||||
<span data-i18n="Scale">Scale</span>
|
||||
</label>
|
||||
<div class="range-block-range-and-counter">
|
||||
<div class="range-block-range">
|
||||
<input type="range" id="global_cfg_guidance_scale" name="volume" min="0.10" max="4.00" step="0.05">
|
||||
</div>
|
||||
<div class="range-block-counter">
|
||||
<div contenteditable="true" data-for="global_cfg_guidance_scale" id="global_cfg_guidance_scale_counter">
|
||||
select
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="global_cfg_negative_prompt">
|
||||
<span data-i18n="Negative Prompt">Negative Prompt</span>
|
||||
</label>
|
||||
<textarea id="global_cfg_negative_prompt" rows="2" class="text_pole textarea_compact" data-i18n="[placeholder]write short replies, write replies using past tense" placeholder="write short replies, write replies using past tense"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="cfg_negative_combine_container">
|
||||
<hr class="sysHR">
|
||||
<div class="inline-drawer">
|
||||
<div id="defaultANBlockToggle" class="inline-drawer-toggle inline-drawer-header">
|
||||
<b>Negative Cascading</b>
|
||||
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
||||
</div>
|
||||
<div class="inline-drawer-content">
|
||||
<small>
|
||||
<b>Combine negative prompts from other boxes.</b>
|
||||
<br />
|
||||
For example, ticking the chat, global, and character boxes combine all negative prompts into a comma-separated string.
|
||||
</small>
|
||||
<br />
|
||||
<label for="cfg_negative_combine">
|
||||
<span data-i18n="Scale">Always Include</span>
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" name="cfg_negative_combine" value="0" />
|
||||
<span data-i18n="Chat Negatives">Chat Negatives</span>
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" name="cfg_negative_combine" value="1" />
|
||||
<span data-i18n="Character Negatives">Character Negatives</span>
|
||||
</label>
|
||||
<label class="checkbox_label">
|
||||
<input type="checkbox" name="cfg_negative_combine" value="2" />
|
||||
<span data-i18n="Global Negatives">Global Negatives</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,5 @@
|
|||
import { callPopup, cancelTtsPlay, eventSource, event_types, isMultigenEnabled, is_send_press, saveSettingsDebounced } from '../../../script.js'
|
||||
import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext } from '../../extensions.js'
|
||||
import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules } from '../../extensions.js'
|
||||
import { escapeRegex, getStringHash } from '../../utils.js'
|
||||
import { EdgeTtsProvider } from './edge.js'
|
||||
import { ElevenLabsTtsProvider } from './elevenlabs.js'
|
||||
|
@ -166,6 +166,11 @@ async function moduleWorker() {
|
|||
}
|
||||
|
||||
function talkingAnimation(switchValue) {
|
||||
if (!modules.includes('talkinghead')) {
|
||||
console.debug("Talking Animation module not loaded");
|
||||
return;
|
||||
}
|
||||
|
||||
const apiUrl = getApiUrl();
|
||||
const animationType = switchValue ? "start" : "stop";
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
@ -1197,6 +1199,7 @@ async function selectGroup() {
|
|||
|
||||
function openCharacterDefinition(characterSelect) {
|
||||
if (is_group_generating) {
|
||||
toastr.warning("Can't peek a character while group reply is being generated");
|
||||
console.warn("Can't peek a character def while group reply is being generated");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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 2011–2014, 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);
|
||||
};
|
||||
|
||||
}));
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
getStoppingStrings,
|
||||
getTextTokens
|
||||
} from "../script.js";
|
||||
import { getCfg } from "./extensions/cfg/util.js";
|
||||
import { tokenizers } from "./power-user.js";
|
||||
|
||||
export {
|
||||
|
@ -34,6 +35,7 @@ const nai_settings = {
|
|||
streaming_novel: false,
|
||||
nai_preamble: default_preamble,
|
||||
prefix: '',
|
||||
cfg_uc: '',
|
||||
};
|
||||
|
||||
const nai_tiers = {
|
||||
|
@ -95,6 +97,7 @@ function loadNovelPreset(preset) {
|
|||
nai_settings.mirostat_lr = preset.mirostat_lr;
|
||||
nai_settings.mirostat_tau = preset.mirostat_tau;
|
||||
nai_settings.prefix = preset.prefix;
|
||||
nai_settings.cfg_uc = preset.cfg_uc || '';
|
||||
loadNovelSettingsUi(nai_settings);
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,7 @@ function loadNovelSettings(settings) {
|
|||
nai_settings.mirostat_tau = settings.mirostat_tau;
|
||||
nai_settings.streaming_novel = !!settings.streaming_novel;
|
||||
nai_settings.prefix = settings.prefix;
|
||||
nai_settings.cfg_uc = settings.cfg_uc || '';
|
||||
loadNovelSettingsUi(nai_settings);
|
||||
}
|
||||
|
||||
|
@ -198,6 +202,7 @@ function loadNovelSettingsUi(ui_settings) {
|
|||
$("#min_length_counter_novel").text(Number(ui_settings.min_length).toFixed(0));
|
||||
$('#nai_preamble_textarea').val(ui_settings.nai_preamble);
|
||||
$('#nai_prefix').val(ui_settings.prefix || "");
|
||||
$('#nai_cfg_uc').val(ui_settings.cfg_uc || "");
|
||||
|
||||
$("#streaming_novel").prop('checked', ui_settings.streaming_novel);
|
||||
}
|
||||
|
@ -305,6 +310,12 @@ const sliders = [
|
|||
format: (val) => `${val}`,
|
||||
setValue: (val) => { nai_settings.min_length = Number(val).toFixed(0); },
|
||||
},
|
||||
{
|
||||
sliderId: "#nai_cfg_uc",
|
||||
counterId: "#nai_cfg_uc_counter",
|
||||
format: (val) => val,
|
||||
setValue: (val) => { nai_settings.cfg_uc = val; },
|
||||
},
|
||||
];
|
||||
|
||||
export function getNovelGenerationData(finalPrompt, this_settings, this_amount_gen, isImpersonate) {
|
||||
|
@ -318,6 +329,7 @@ export function getNovelGenerationData(finalPrompt, this_settings, this_amount_g
|
|||
: undefined;
|
||||
|
||||
const prefix = nai_settings.prefix || autoSelectPrefix(finalPrompt);
|
||||
const cfgSettings = getCfg();
|
||||
|
||||
return {
|
||||
"input": finalPrompt,
|
||||
|
@ -339,8 +351,8 @@ export function getNovelGenerationData(finalPrompt, this_settings, this_amount_g
|
|||
"top_g": parseFloat(nai_settings.top_g),
|
||||
"mirostat_lr": parseFloat(nai_settings.mirostat_lr),
|
||||
"mirostat_tau": parseFloat(nai_settings.mirostat_tau),
|
||||
"cfg_scale": parseFloat(nai_settings.cfg_scale),
|
||||
"cfg_uc": "",
|
||||
"cfg_scale": cfgSettings?.guidanceScale ?? parseFloat(nai_settings.cfg_scale),
|
||||
"cfg_uc": cfgSettings?.negativePrompt ?? nai_settings.cfg_uc ?? "",
|
||||
"phrase_rep_pen": nai_settings.phrase_rep_pen,
|
||||
//"stop_sequences": {{187}},
|
||||
"stop_sequences": stopSequences,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,8 @@ import {
|
|||
setGenerationParamsFromPreset,
|
||||
} from "../script.js";
|
||||
|
||||
import { getCfg } from "./extensions/cfg/util.js";
|
||||
|
||||
import {
|
||||
power_user,
|
||||
} from "./power-user.js";
|
||||
|
@ -230,6 +232,8 @@ async function generateTextGenWithStreaming(generate_data, signal) {
|
|||
}
|
||||
|
||||
export function getTextGenGenerationData(finalPromt, this_amount_gen, isImpersonate) {
|
||||
const cfgValues = getCfg();
|
||||
|
||||
return {
|
||||
'prompt': finalPromt,
|
||||
'max_new_tokens': this_amount_gen,
|
||||
|
@ -247,6 +251,8 @@ export function getTextGenGenerationData(finalPromt, this_amount_gen, isImperson
|
|||
'penalty_alpha': textgenerationwebui_settings.penalty_alpha,
|
||||
'length_penalty': textgenerationwebui_settings.length_penalty,
|
||||
'early_stopping': textgenerationwebui_settings.early_stopping,
|
||||
'guidance_scale': cfgValues?.guidanceScale ?? 1,
|
||||
'negative_prompt': cfgValues?.negativePrompt ?? '',
|
||||
'seed': textgenerationwebui_settings.seed,
|
||||
'add_bos_token': textgenerationwebui_settings.add_bos_token,
|
||||
'stopping_strings': getStoppingStrings(isImpersonate, false),
|
||||
|
|
|
@ -375,15 +375,18 @@ export class IndexedDBStore {
|
|||
this.dbName = dbName;
|
||||
this.storeName = storeName;
|
||||
this.db = null;
|
||||
this.version = Date.now();
|
||||
}
|
||||
|
||||
async open() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = indexedDB.open(this.dbName);
|
||||
const request = indexedDB.open(this.dbName, this.version);
|
||||
|
||||
request.onupgradeneeded = (event) => {
|
||||
const db = event.target.result;
|
||||
db.createObjectStore(this.storeName, { keyPath: null, autoIncrement: false });
|
||||
if (!db.objectStoreNames.contains(this.storeName)) {
|
||||
db.createObjectStore(this.storeName, { keyPath: null, autoIncrement: false });
|
||||
}
|
||||
};
|
||||
|
||||
request.onsuccess = (event) => {
|
||||
|
|
|
@ -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";
|
||||
|
@ -1331,7 +1331,6 @@ export async function importEmbeddedWorldInfo() {
|
|||
}
|
||||
|
||||
function onWorldInfoChange(_, text) {
|
||||
let selectedWorlds;
|
||||
if (_ !== '__notSlashCommand__') { // if it's a slash command
|
||||
if (text !== undefined) { // and args are provided
|
||||
const slashInputSplitText = text.trim().toLowerCase().split(",");
|
||||
|
@ -1339,12 +1338,14 @@ function onWorldInfoChange(_, text) {
|
|||
slashInputSplitText.forEach((worldName) => {
|
||||
const wiElement = getWIElement(worldName);
|
||||
if (wiElement.length > 0) {
|
||||
selected_world_info.push(wiElement.text());
|
||||
wiElement.prop("selected", true);
|
||||
toastr.success(`Activated world: ${wiElement.text()}`);
|
||||
} else {
|
||||
toastr.error(`No world found named: ${worldName}`);
|
||||
}
|
||||
})
|
||||
});
|
||||
$("#world_info").trigger("change");
|
||||
} else { // if no args, unset all worlds
|
||||
toastr.success('Deactivated all worlds');
|
||||
selected_world_info = [];
|
||||
|
@ -1369,6 +1370,7 @@ function onWorldInfoChange(_, text) {
|
|||
}
|
||||
|
||||
saveSettingsDebounced();
|
||||
eventSource.emit(event_types.WORLDINFO_SETTINGS_UPDATED);
|
||||
}
|
||||
|
||||
export async function importWorldInfo(file) {
|
||||
|
@ -1505,36 +1507,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 () {
|
||||
|
@ -1545,7 +1552,7 @@ jQuery(() => {
|
|||
$('#world_info_budget_cap').on('input', function () {
|
||||
world_info_budget_cap = Number($(this).val());
|
||||
$("#world_info_budget_cap_counter").text(world_info_budget_cap);
|
||||
saveSettingsDebounced();
|
||||
saveSettings();
|
||||
});
|
||||
|
||||
$('#world_button').on('click', async function () {
|
||||
|
|
|
@ -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;
|
||||
|
@ -1289,7 +1349,7 @@ body.charListGrid #rm_print_characters_block .tags_inline {
|
|||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#floatingPrompt {
|
||||
#floatingPrompt, #cfgConfig {
|
||||
overflow-y: auto;
|
||||
max-width: 90svw;
|
||||
max-height: 90svh;
|
||||
|
@ -4268,7 +4328,6 @@ input.extension_missing[type="checkbox"] {
|
|||
margin: 0;
|
||||
left: 0;
|
||||
right: auto;
|
||||
padding: 5px;
|
||||
border-radius: 10px;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
|
@ -4280,6 +4339,10 @@ input.extension_missing[type="checkbox"] {
|
|||
height: calc(100% - 30px);
|
||||
}
|
||||
|
||||
.fillLeft .scrollableInner {
|
||||
padding: 0.5em 1em 0.5em 0.5em
|
||||
}
|
||||
|
||||
.width100p {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -5106,7 +5169,8 @@ body.waifuMode .zoomed_avatar {
|
|||
|
||||
#right-nav-panel,
|
||||
#left-nav-panel,
|
||||
#floatingPrompt {
|
||||
#floatingPrompt,
|
||||
#cfgConfig {
|
||||
height: calc(100vh - 45px);
|
||||
height: calc(100svh - 45px);
|
||||
min-width: 100% !important;
|
||||
|
@ -5122,7 +5186,8 @@ body.waifuMode .zoomed_avatar {
|
|||
backdrop-filter: blur(calc(var(--SmartThemeBlurStrength) * 2));
|
||||
}
|
||||
|
||||
#floatingPrompt {
|
||||
#floatingPrompt,
|
||||
#cfgConfig {
|
||||
height: min-content;
|
||||
}
|
||||
|
||||
|
@ -5349,6 +5414,7 @@ body.waifuMode .zoomed_avatar {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Customize the Select2 container */
|
||||
.select2-container {
|
||||
color: var(--SmartThemeBodyColor);
|
||||
|
@ -5491,4 +5557,4 @@ body.waifuMode .zoomed_avatar {
|
|||
height: 16px;
|
||||
vertical-align: middle;
|
||||
/* To align with adjacent text */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue