Merge branch 'staging' of http://github.com/SillyTavern/SillyTavern into staging

This commit is contained in:
Cohee 2023-08-18 12:11:32 +03:00
commit f4dcd89ef6
26 changed files with 7253 additions and 511 deletions

View File

@ -64,11 +64,6 @@
"collapse_newlines": false, "collapse_newlines": false,
"pygmalion_formatting": 0, "pygmalion_formatting": 0,
"pin_examples": false, "pin_examples": false,
"disable_description_formatting": false,
"disable_scenario_formatting": false,
"disable_personality_formatting": false,
"disable_examples_formatting": false,
"disable_start_formatting": false,
"trim_sentences": false, "trim_sentences": false,
"include_newline": false, "include_newline": false,
"always_force_name2": true, "always_force_name2": true,
@ -77,7 +72,6 @@
"multigen": false, "multigen": false,
"multigen_first_chunk": 50, "multigen_first_chunk": 50,
"multigen_next_chunks": 30, "multigen_next_chunks": 30,
"custom_chat_separator": "",
"markdown_escape_strings": "", "markdown_escape_strings": "",
"fast_ui_mode": false, "fast_ui_mode": false,
"avatar_style": 0, "avatar_style": 0,
@ -312,9 +306,6 @@
"None": {} "None": {}
} }
}, },
"context_settings": {
"selected_template": ""
},
"tags": [ "tags": [
{ {
"id": "1345561466591", "id": "1345561466591",

View File

@ -1,5 +0,0 @@
{
"name": "Classic",
"storyString": "{{instructSystemPrompt}}\n{{wiBeforeCharacter}}\n{{description}}\n{{char}}'s personality: {{personality}}\nCircumstances and context of the dialogue: {{scenario}}\n{{wiAfterCharacter}}\nThis is how {{char}} should talk\n{{mesExamples}}\nThen the roleplay chat between {{user}} and {{char}} begins\n",
"injections": []
}

View File

@ -0,0 +1,6 @@
{
"name": "Default",
"story_string": "{{#if description}}{{{description}}}{{/if}}\n{{#if personality}}{{{personality}}}{{/if}}\n{{#if scenario}}Scenario: {{{scenario}}}{{/if}}",
"chat_start": "***",
"example_separator": "***"
}

View File

@ -1,5 +1,6 @@
{ {
"name": "Pygmalion", "name": "Pygmalion",
"storyString": "{{instructSystemPrompt}}\n{{wiBeforeCharacter}}\n{{char}}'s Persona: {{description}}\nPersonality: {{personality}}\nScenario: {{scenario}}\n{{wiAfterCharacter}}\n<START>\n{{mesExamples}}\n<START>\n", "story_string": "{{#if description}}{{{char}}}'s Persona: {{{description}}}{{/if}}\n{{#if personality}}Personality: {{{personality}}}{{/if}}\n{{#if scenario}}Scenario: {{{scenario}}}{{/if}}",
"injections": [] "chat_start": "<START>",
"example_separator": "<START>"
} }

View File

@ -41,6 +41,7 @@
<script src="scripts/seedrandom.min.js"></script> <script src="scripts/seedrandom.min.js"></script>
<script src="scripts/droll.js"></script> <script src="scripts/droll.js"></script>
<script src="scripts/localforage.min.js"></script> <script src="scripts/localforage.min.js"></script>
<script src="scripts/handlebars.js"></script>
<script type="module" src="scripts/eventemitter.js"></script> <script type="module" src="scripts/eventemitter.js"></script>
<script type="module" src="scripts/power-user.js"></script> <script type="module" src="scripts/power-user.js"></script>
<script type="module" src="scripts/swiped-events.js"></script> <script type="module" src="scripts/swiped-events.js"></script>
@ -94,7 +95,6 @@
<script type="module" src="scripts/slash-commands.js"></script> <script type="module" src="scripts/slash-commands.js"></script>
<script type="module" src="scripts/tags.js"></script> <script type="module" src="scripts/tags.js"></script>
<script type="module" src="scripts/secrets.js"></script> <script type="module" src="scripts/secrets.js"></script>
<script type="module" src="scripts/context-template.js"></script>
<script type="module" src="scripts/extensions.js"></script> <script type="module" src="scripts/extensions.js"></script>
<script type="module" src="scripts/authors-note.js"></script> <script type="module" src="scripts/authors-note.js"></script>
<script type="module" src="scripts/preset-manager.js"></script> <script type="module" src="scripts/preset-manager.js"></script>
@ -2006,58 +2006,40 @@
</h3> </h3>
<div class="flex-container"> <div class="flex-container">
<div name="PygOverrides" class="flex1"> <div name="PygOverrides" class="flex1">
<h4><span data-i18n="AutoFormat Overrides">AutoFormat Overrides</span></h4>
<label class="checkbox_label" for="disable-description-formatting-checkbox">
<input id="disable-description-formatting-checkbox" type="checkbox" />
<span data-i18n="Disable description formatting">Disable description formatting</span>
</label>
<label class="checkbox_label" for="disable-scenario-formatting-checkbox">
<input id="disable-scenario-formatting-checkbox" type="checkbox" />
<span data-i18n="Disable scenario formatting"> Disable scenario formatting</span>
</label>
<label class="checkbox_label" for="disable-personality-formatting-checkbox">
<input id="disable-personality-formatting-checkbox" type="checkbox" />
<span data-i18n="Disable personality formatting"> Disable personality formatting</span>
</label>
<label class="checkbox_label" for="disable-examples-formatting-checkbox">
<input id="disable-examples-formatting-checkbox" type="checkbox" />
<span data-i18n="Disable example chats formatting">Disable example chats formatting</span>
</label>
<label class="checkbox_label" for="disable-start-formatting-checkbox">
<input id="disable-start-formatting-checkbox" type="checkbox" />
<span data-i18n="Disable chat start formatting">Disable chat start formatting</span>
</label>
<label class="checkbox_label" for="trim_spaces">
<input id="trim_spaces" type="checkbox" />
<span data-i18n="Trim spaces">Trim spaces</span>
</label>
<label class="checkbox_label" for="trim_sentences_checkbox">
<input id="trim_sentences_checkbox" type="checkbox" />
<span data-i18n="Trim Incomplete Sentences">Trim Incomplete Sentences</span>
</label>
<!-- Add margin since this is a child of above -->
<label class="checkbox_label indent20p" for="include_newline_checkbox">
<input id="include_newline_checkbox" type="checkbox" />
<span data-i18n="Include Newline">Include Newline</span>
</label>
<div> <div>
<h4 data-i18n="Custom Chat Separator"> <h4 data-i18n="Context Template">
Custom Chat Separator Context Template
</h4> </h4>
<div class="flex-container flexGap5">
<select id="context_presets" class="flex1 margin0">
</select>
</div>
<div> <div>
<textarea id="custom_chat_separator" class="text_pole textarea_compact" type="text" placeholder="&lt;START&gt;" maxlength="500" rows="1"></textarea> <label for="context_story_string" data-i18n="Story String">
Story String
</label>
<textarea id="context_story_string" class="text_pole textarea_compact" rows="3"></textarea>
<div class="flex-container">
<div class="flex1">
<label for="context_example_separator">
<span data-i18n="Example Separator">Example Separator</span>
</label>
<div>
<textarea id="context_example_separator" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
<label for="context_chat_start">
<span data-i18n="Chat Start">Chat Start</span>
</label>
<div>
<textarea id="context_chat_start" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div> <div>
<h4 data-i18n="Non-markdown strings">
Non-markdown strings
</h4>
<div>
<input id="markdown_escape_strings" class="text_pole textarea_compact" type="text" data-i18n="[placeholder]separate with commas w/o space between" placeholder="separate with commas w/o space between" maxlength="100" />
</div>
</div>
<div>
<h4 data-i18n="Instruct mode">Instruct mode <h4 data-i18n="Instruct mode">Instruct mode
<a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank"> <a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
<span class="note-link-span">?</span> <span class="note-link-span">?</span>
@ -2099,18 +2081,26 @@
<div class="flex-container"> <div class="flex-container">
<div class="flex1"> <div class="flex1">
<label for="instruct_input_sequence"> <label for="instruct_input_sequence">
<span data-i18n="Input Sequence">Input Sequence</span> <small data-i18n="Input Sequence">Input Sequence</small>
</label> </label>
<div> <div>
<textarea id="instruct_input_sequence" class="text_pole textarea_compact" type="text" maxlength="500" rows="1"></textarea> <textarea id="instruct_input_sequence" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div> </div>
</div> </div>
<div class="flex1"> <div class="flex1">
<label for="instruct_output_sequence"> <label for="instruct_output_sequence">
<span data-i18n="Output Sequence">Output Sequence</span> <small data-i18n="Output Sequence">Output Sequence</small>
</label> </label>
<div> <div>
<textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea> <textarea id="instruct_output_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div>
</div>
<div class="flex1">
<label for="instruct_last_output_sequence">
<small data-i18n="Last Sequence">Last Sequence</small>
</label>
<div>
<textarea id="instruct_last_output_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div> </div>
</div> </div>
</div> </div>
@ -2120,7 +2110,7 @@
<small data-i18n="System Sequence">System Sequence</small> <small data-i18n="System Sequence">System Sequence</small>
</label> </label>
<div> <div>
<textarea id="instruct_system_sequence" class="text_pole textarea_compact" type="text" maxlength="500" rows="1"></textarea> <textarea id="instruct_system_sequence" class="text_pole textarea_compact" maxlength="500" rows="1"></textarea>
</div> </div>
</div> </div>
<div class="flex1"> <div class="flex1">
@ -2128,7 +2118,7 @@
<small data-i18n="Stop Sequence">Stop Sequence</small> <small data-i18n="Stop Sequence">Stop Sequence</small>
</label> </label>
<div> <div>
<textarea id="instruct_stop_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea> <textarea id="instruct_stop_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div> </div>
</div> </div>
<div class="flex1"> <div class="flex1">
@ -2136,14 +2126,22 @@
<small data-i18n="Separator">Separator</small> <small data-i18n="Separator">Separator</small>
</label> </label>
<div> <div>
<textarea id="instruct_separator_sequence" class="text_pole wide100p textarea_compact" type="text" maxlength="500" rows="1"></textarea> <textarea id="instruct_separator_sequence" class="text_pole wide100p textarea_compact" maxlength="500" rows="1"></textarea>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div>
<h4 data-i18n="Non-markdown strings">
Non-markdown strings
</h4>
<div>
<input id="markdown_escape_strings" class="text_pole textarea_compact" type="text" data-i18n="[placeholder]separate with commas w/o space between" placeholder="separate with commas w/o space between" maxlength="100" />
</div>
</div>
</div> </div>
<div name="ContextFormatting" class="flex1"> <div name="ContextFormatting" class="flex1">
<h4><span data-i18n="Context Formatting">Context Formatting</span></h4>
<div> <div>
<h4><span data-i18n="Tokenizer">Tokenizer</span> <h4><span data-i18n="Tokenizer">Tokenizer</span>
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank"> <a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#tokenizer" class="notes-link" target="_blank">
@ -2187,19 +2185,19 @@
Remove Empty New Lines from Output Remove Empty New Lines from Output
</span> </span>
</label> </label>
<div id="context-templates-block" class="template_element"> <label class="checkbox_label" for="trim_spaces">
<h4> <input id="trim_spaces" type="checkbox" />
Context Templates <span data-i18n="Trim spaces">Trim spaces</span>
</h4> </label>
<div class="flex-container flexGap5"> <label class="checkbox_label" for="trim_sentences_checkbox">
<select id="context_template" class="flex1 margin0"> <input id="trim_sentences_checkbox" type="checkbox" />
</select> <span data-i18n="Trim Incomplete Sentences">Trim Incomplete Sentences</span>
<div id="context_template_new" class="menu_button fa-solid fa-plus margin0" title="Create new" data-i18n="[title]Create New"></div> </label>
<div id="context_template_edit" class="menu_button fa-solid fa-file-pen margin0" title="Edit" data-i18n="[title]Edit"></div> <!-- Add margin since this is a child of above -->
<div id="context_template_rename" class="menu_button fa-solid fa-i-cursor margin0" title="Rename" data-i18n="[title]Rename"></div> <label class="checkbox_label indent20p" for="include_newline_checkbox">
<div id="context_template_delete" class="menu_button fa-solid fa-trash-can margin0" title="Delete" data-i18n="[title]Delete"></div> <input id="include_newline_checkbox" type="checkbox" />
</div> <span data-i18n="Include Newline">Include Newline</span>
</div> </label>
<div> <div>
<h4> <h4>
<span data-i18n="Start Reply With"> <span data-i18n="Start Reply With">

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "### Instruction:", "input_sequence": "### Instruction:",
"output_sequence": "### Response:", "output_sequence": "### Response:",
"last_output_sequence": "",
"separator_sequence": "", "separator_sequence": "",
"wrap": true "wrap": true
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "USER: ", "input_sequence": "USER: ",
"output_sequence": "GPT: ", "output_sequence": "GPT: ",
"last_output_sequence": "",
"separator_sequence": "</s>", "separator_sequence": "</s>",
"wrap": false "wrap": false
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "[INST]", "input_sequence": "[INST]",
"output_sequence": "[/INST]", "output_sequence": "[/INST]",
"last_output_sequence": "",
"separator_sequence": "\n", "separator_sequence": "\n",
"wrap": false "wrap": false
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "</s>", "stop_sequence": "</s>",
"input_sequence": "<|user|>", "input_sequence": "<|user|>",
"output_sequence": "<|model|>", "output_sequence": "<|model|>",
"last_output_sequence": "",
"separator_sequence": "", "separator_sequence": "",
"wrap": false "wrap": false
} }

View File

@ -4,6 +4,7 @@
"name": "OpenOrca/OpenChat", "name": "OpenOrca/OpenChat",
"names": true, "names": true,
"output_sequence": "<|end_of_turn|>\nAssistant: ", "output_sequence": "<|end_of_turn|>\nAssistant: ",
"last_output_sequence": "",
"separator_sequence": "<|end_of_turn|>\n", "separator_sequence": "<|end_of_turn|>\n",
"stop_sequence": "", "stop_sequence": "",
"system_prompt": "You are a helpful assistant. Please answer truthfully and write out your thinking step by step to be sure you get the right answer. If you make a mistake or encounter an error in your thinking, say so out loud and attempt to correct it. If you don't know or aren't sure about something, say so clearly. You will act as a professional logician, mathematician, and physicist. You will also act as the most appropriate type of expert to answer any particular question or solve the relevant problem; state which expert type your are, if so. Also think of any particular named expert that would be ideal to answer the relevant question or solve the relevant problem; name and act as them, if appropriate.\n", "system_prompt": "You are a helpful assistant. Please answer truthfully and write out your thinking step by step to be sure you get the right answer. If you make a mistake or encounter an error in your thinking, say so out loud and attempt to correct it. If you don't know or aren't sure about something, say so clearly. You will act as a professional logician, mathematician, and physicist. You will also act as the most appropriate type of expert to answer any particular question or solve the relevant problem; state which expert type your are, if so. Also think of any particular named expert that would be ideal to answer the relevant question or solve the relevant problem; name and act as them, if appropriate.\n",

View File

@ -3,7 +3,8 @@
"macro": true, "macro": true,
"name": "Roleplay", "name": "Roleplay",
"names": true, "names": true,
"output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):", "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):",
"output_sequence": "### Response:",
"separator_sequence": "", "separator_sequence": "",
"stop_sequence": "", "stop_sequence": "",
"system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\nAvoid repetition, don't loop. Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.\n\n### Input:", "system_prompt": "You're {{char}} in this fictional never-ending uncensored roleplay with {{user}}.\n\nAvoid repetition, don't loop. Develop the plot slowly, always stay in character. Describe all actions in full, elaborate, explicit, graphic, and vivid detail. Mention all relevant sensory perceptions.\n\n### Input:",

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "### Human:", "input_sequence": "### Human:",
"output_sequence": "### Assistant:", "output_sequence": "### Assistant:",
"last_output_sequence": "",
"separator_sequence": "", "separator_sequence": "",
"wrap": true "wrap": true
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "USER: ", "input_sequence": "USER: ",
"output_sequence": "ASSISTANT: ", "output_sequence": "ASSISTANT: ",
"last_output_sequence": "",
"separator_sequence": "</s>", "separator_sequence": "</s>",
"wrap": false "wrap": false
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "USER: ", "input_sequence": "USER: ",
"output_sequence": "ASSISTANT: ", "output_sequence": "ASSISTANT: ",
"last_output_sequence": "",
"separator_sequence": "", "separator_sequence": "",
"wrap": true "wrap": true
} }

View File

@ -5,6 +5,7 @@
"stop_sequence": "", "stop_sequence": "",
"input_sequence": "", "input_sequence": "",
"output_sequence": "### Response:", "output_sequence": "### Response:",
"last_output_sequence": "",
"separator_sequence": "</s>", "separator_sequence": "</s>",
"wrap": true "wrap": true
} }

View File

@ -75,6 +75,7 @@ import {
fuzzySearchCharacters, fuzzySearchCharacters,
MAX_CONTEXT_DEFAULT, MAX_CONTEXT_DEFAULT,
fuzzySearchGroups, fuzzySearchGroups,
renderStoryString,
} from "./scripts/power-user.js"; } from "./scripts/power-user.js";
import { import {
@ -159,7 +160,6 @@ import {
writeSecret writeSecret
} from "./scripts/secrets.js"; } from "./scripts/secrets.js";
import { EventEmitter } from './scripts/eventemitter.js'; import { EventEmitter } from './scripts/eventemitter.js';
import { context_settings, loadContextTemplatesFromSettings } from "./scripts/context-template.js";
import { markdownExclusionExt } from "./scripts/showdown-exclusion.js"; import { markdownExclusionExt } from "./scripts/showdown-exclusion.js";
import { NOTE_MODULE_NAME, metadata_keys, setFloatingPrompt, shouldWIAddPrompt } from "./scripts/authors-note.js"; import { NOTE_MODULE_NAME, metadata_keys, setFloatingPrompt, shouldWIAddPrompt } from "./scripts/authors-note.js";
import { deviceInfo } from "./scripts/RossAscends-mods.js"; import { deviceInfo } from "./scripts/RossAscends-mods.js";
@ -301,7 +301,6 @@ let firstRun = false;
const default_ch_mes = "Hello"; const default_ch_mes = "Hello";
let count_view_mes = 0; let count_view_mes = 0;
let mesStr = "";
let generatedPromtCache = ""; let generatedPromtCache = "";
let generation_started = new Date(); let generation_started = new Date();
let characters = []; let characters = [];
@ -311,8 +310,6 @@ const default_avatar = "img/ai4.png";
export const system_avatar = "img/five.png"; export const system_avatar = "img/five.png";
export const comment_avatar = "img/quill.png"; export const comment_avatar = "img/quill.png";
export let CLIENT_VERSION = 'SillyTavern:UNKNOWN:Cohee#1207'; // For Horde header export let CLIENT_VERSION = 'SillyTavern:UNKNOWN:Cohee#1207'; // For Horde header
let is_colab = false;
let is_checked_colab = false;
let optionsPopper = Popper.createPopper(document.getElementById('options_button'), document.getElementById('options'), { let optionsPopper = Popper.createPopper(document.getElementById('options_button'), document.getElementById('options'), {
placement: 'top-start' placement: 'top-start'
}); });
@ -331,10 +328,6 @@ let is_delete_mode = false;
let fav_ch_checked = false; let fav_ch_checked = false;
let scrollLock = false; let scrollLock = false;
//initialize global var for future cropped blobs
let currentCroppedAvatar = '';
const durationSaveEdit = 1000; const durationSaveEdit = 1000;
const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit); const saveSettingsDebounced = debounce(() => saveSettings(), durationSaveEdit);
export const saveCharacterDebounced = debounce(() => $("#create_button").trigger('click'), durationSaveEdit); export const saveCharacterDebounced = debounce(() => $("#create_button").trigger('click'), durationSaveEdit);
@ -1095,30 +1088,6 @@ function getBackgroundFromTemplate(bg) {
return template; return template;
} }
async function isColab() {
is_checked_colab = true;
const response = await fetch("/iscolab", {
method: "POST",
headers: getRequestHeaders(),
body: JSON.stringify({
"": "",
}),
});
if (response.ok === true) {
const getData = await response.json();
if (getData.colaburl != false) {
$("#colab_shadow_popup").css("display", "none");
is_colab = true;
let url = String(getData.colaburl).split("flare.com")[0] + "flare.com";
url = String(url).split("loca.lt")[0] + "loca.lt";
$("#api_url_text").val(url);
setTimeout(function () {
$("#api_button").click();
}, 2000);
}
}
}
async function setBackground(bg) { async function setBackground(bg) {
jQuery.ajax({ jQuery.ajax({
@ -2067,13 +2036,6 @@ function baseChatReplace(value, name1, name2) {
return value; return value;
} }
function appendToStoryString(value, prefix) {
if (value !== undefined && value.length > 0) {
return prefix + value + '\n';
}
return '';
}
function isStreamingEnabled() { function isStreamingEnabled() {
return ((main_api == 'openai' && oai_settings.stream_openai && oai_settings.chat_completion_source !== chat_completion_sources.SCALE) return ((main_api == 'openai' && oai_settings.stream_openai && oai_settings.chat_completion_source !== chat_completion_sources.SCALE)
|| (main_api == 'kobold' && kai_settings.streaming_kobold && kai_settings.can_use_streaming) || (main_api == 'kobold' && kai_settings.streaming_kobold && kai_settings.can_use_streaming)
@ -2479,11 +2441,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
if (mesExamples.replace(/<START>/gi, '').trim().length === 0) { if (mesExamples.replace(/<START>/gi, '').trim().length === 0) {
mesExamples = ''; mesExamples = '';
} }
const blockHeading =
main_api === 'openai' ? '<START>' : // OpenAI handler always expects it // OpenAI handler always expects it
power_user.custom_chat_separator ? power_user.custom_chat_separator : const blockHeading = main_api === 'openai' ? '<START>' : (power_user.context.example_separator || '');
power_user.disable_examples_formatting ? '' :
is_pygmalion ? '<START>' : `This is how ${name2} should talk`;
let mesExamplesArray = mesExamples.split(/<START>/gi).slice(1).map(block => `${blockHeading}\n${block.trim()}\n`); let mesExamplesArray = mesExamples.split(/<START>/gi).slice(1).map(block => `${blockHeading}\n${block.trim()}\n`);
// First message in fresh 1-on-1 chat reacts to user/character settings changes // First message in fresh 1-on-1 chat reacts to user/character settings changes
@ -2509,17 +2469,15 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
console.log(`Core/all messages: ${coreChat.length}/${chat.length}`); console.log(`Core/all messages: ${coreChat.length}/${chat.length}`);
let storyString = ""; const storyStringParams = {
description: charDescription,
personality: charPersonality,
scenario: Scenario,
char: name2,
user: name1,
};
if (is_pygmalion) { let storyString = renderStoryString(storyStringParams);
storyString += appendToStoryString(charDescription, power_user.disable_description_formatting ? '' : name2 + "'s Persona: ");
storyString += appendToStoryString(charPersonality, power_user.disable_personality_formatting ? '' : 'Personality: ');
storyString += appendToStoryString(Scenario, power_user.disable_scenario_formatting ? '' : 'Scenario: ');
} else {
storyString += appendToStoryString(charDescription, '');
storyString += appendToStoryString(charPersonality, power_user.disable_personality_formatting ? '' : name2 + "'s personality: ");
storyString += appendToStoryString(Scenario, power_user.disable_scenario_formatting ? '' : 'Circumstances and context of the dialogue: ');
}
// kingbri MARK: - Make sure the prompt bias isn't the same as the user bias // kingbri MARK: - Make sure the prompt bias isn't the same as the user bias
if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || is_pygmalion) { if ((promptBias && !isUserPromptBias) || power_user.always_force_name2 || is_pygmalion) {
@ -3368,31 +3326,17 @@ function addChatsPreamble(mesSendString) {
} }
function addChatsSeparator(mesSendString) { function addChatsSeparator(mesSendString) {
if (power_user.custom_chat_separator && power_user.custom_chat_separator.length) { if (main_api === 'novel') {
mesSendString = power_user.custom_chat_separator + '\n' + mesSendString; return '***\n' + mesSendString;
} }
// if chat start formatting is disabled else if (power_user.context.chat_start) {
else if (power_user.disable_start_formatting) { return power_user.context.chat_start + '\n' + mesSendString;
mesSendString = mesSendString;
} }
else if (main_api === 'novel') {
mesSendString = '***\n' + mesSendString;
}
// add non-pygma dingus
else if (!is_pygmalion) {
mesSendString = '\nThen the roleplay chat between ' + name1 + ' and ' + name2 + ' begins.\n' + mesSendString;
}
// add pygma <START>
else { else {
mesSendString = '<START>\n' + mesSendString; return mesSendString;
//mesSendString = mesSendString; //This edit simply removes the first "<START>" that is prepended to all context prompts
} }
return mesSendString;
} }
function appendZeroDepthAnchor(force_name2, zeroDepthAnchor, finalPromt) { function appendZeroDepthAnchor(force_name2, zeroDepthAnchor, finalPromt) {
@ -5290,9 +5234,6 @@ async function getSettings(type) {
// Load character tags // Load character tags
loadTagsSettings(settings); loadTagsSettings(settings);
// Load context templates
loadContextTemplatesFromSettings(data, settings);
// Allow subscribers to mutate settings // Allow subscribers to mutate settings
eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings); eventSource.emit(event_types.SETTINGS_LOADED_AFTER, settings);
@ -5360,8 +5301,6 @@ async function getSettings(type) {
} }
} }
if (!is_checked_colab) isColab();
eventSource.emit(event_types.SETTINGS_LOADED); eventSource.emit(event_types.SETTINGS_LOADED);
} }
@ -5396,7 +5335,6 @@ async function saveSettings(type) {
horde_settings: horde_settings, horde_settings: horde_settings,
power_user: power_user, power_user: power_user,
extension_settings: extension_settings, extension_settings: extension_settings,
context_settings: context_settings,
tags: tags, tags: tags,
tag_map: tag_map, tag_map: tag_map,
nai_settings: nai_settings, nai_settings: nai_settings,
@ -8285,7 +8223,6 @@ $(document).ready(function () {
const formattedValue = slider.format(value); const formattedValue = slider.format(value);
slider.setValue(value); slider.setValue(value);
$(slider.counterId).text(formattedValue); $(slider.counterId).text(formattedValue);
console.log('saving');
saveSettingsDebounced(); saveSettingsDebounced();
}); });
}); });

View File

@ -1,214 +0,0 @@
import {
callPopup,
getRequestHeaders,
saveSettingsDebounced,
} from '../script.js';
import { debounce } from './utils.js';
export let context_templates = [];
export let context_settings = {
selected_template: '',
};
const saveTemplateDebounced = debounce((name) => alert('implement me', name), 2000);
export function loadContextTemplatesFromSettings(data, settings) {
context_templates = data.context || [];
context_settings = Object.assign(context_settings, (settings.context_settings || {}));
const dropdown = $('#context_template');
dropdown.empty();
dropdown.append('<option value="">-- None --</option>')
for (const template of context_templates) {
const name = template.name;
const option = document.createElement('option');
option.innerText = name;
option.value = name;
option.selected = context_settings.selected_template == name;
dropdown.append(option);
}
}
function onContextTemplateChange() {
const value = $(this).find(':selected').val();
context_settings.selected_template = value;
saveSettingsDebounced();
}
function openContextTemplateEditor() {
const template = context_templates.find(x => x.name == context_settings.selected_template);
if (!template || !context_settings.selected_template) {
toastr.info('No context template selected');
return;
}
const editor = $('#context_editor_template .context_editor').clone();
const injectionsContainer = editor.find('.chat_injections_list');
editor.find('.template_name').text(template.name);
editor.find('.story_string_template').text(template.storyString).on('input', function () {
const value = $(this).val();
template.storyString = value;
saveTemplateDebounced(template.name);
});
editor.find('.chat_injection_add').on('click', function () {
const injection = { id: Date.now(), text: '', depth: 0 };
template.injections.push(injection);
addChatInjection(injectionsContainer, injection, template);
saveTemplateDebounced(template.name);
});
for (const injection of template.injections) {
addChatInjection(injectionsContainer, injection, template);
}
$('#dialogue_popup').addClass('large_dialogue_popup wide_dialogue_popup');
callPopup(editor, 'text');
}
async function onRenameContextTemplateClick() {
const oldName = context_settings.selected_template;
const newName = await inputTemplateName();
const template = context_templates.find(x => x.name === oldName);
if (!template || !newName || oldName === newName) {
return;
}
await saveContextTemplate(newName);
context_settings.selected_template = newName;
saveSettingsDebounced();
await deleteContextTemplate(oldName);
toastr.success('Context template renamed', newName);
}
async function deleteContextTemplate(name) {
const response = await fetch('/delete_context_template', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name }),
});
if (!response.ok) {
throw new Error('Context template not deleted');
}
}
async function saveContextTemplate(name) {
const template = context_templates.find(x => x.name === name);
if (!template) {
throw new Error(`Context template not found: ${name}`);
}
const response = await fetch('/save_context_template', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ name, template }),
});
if (!response.ok) {
throw new Error('Context template not saved');
}
}
async function inputTemplateName() {
let name = await callPopup('Enter a template name:', 'input');
if (!name) {
return false;
}
name = DOMPurify.sanitize(name.trim());
if (context_templates.findIndex(x => x.name == name) > -1) {
toastr.warning('Template with that name already exists', 'Pick a unique name');
return false;
}
return name;
}
function addChatInjection(container, model, parent) {
const template = $('#chat_injection_template .chat_injection').clone();
template.attr('id', model.id);
template.find('.chat_injection_text').val(model.text).on('input', function () {
const value = $(this).val();
model.text = value;
saveTemplateDebounced(parent.name);
});
template.find('.chat_injection_depth').val(model.depth).on('input', function () {
const value = Math.abs(Number($(this).val()));
model.depth = value;
saveTemplateDebounced(parent.name);
});
template.find('.chat_injection_remove').on('click', function () {
if (!confirm('Are you sure?')) {
return;
}
const index = parent.injections.findIndex(x => x == model);
if (index === -1) {
console.error('Does not compute, injection index was lost');
return;
}
parent.injections.splice(index, 1);
template.remove();
saveTemplateDebounced(parent.name);
});
container.append(template);
}
function copyTemplateParameter(event) {
const text = $(event.target).text();
navigator.clipboard.writeText(text);
toastr.info('Copied!', '', { timeOut: 2000 });
}
async function onNewContextTemplateClick() {
const name = await inputTemplateName();
if (!name) {
return;
}
const template = { name: name, injections: [], storyString: '' };
context_templates.push(template);
const option = document.createElement('option');
option.innerText = name;
option.value = name;
option.selected = true;
$('#context_template').append(option).val(name).trigger('change');
saveTemplateDebounced(name);
}
async function onDeleteContextTemplateClick() {
const template = context_templates.find(x => x.name == context_settings.selected_template);
if (!template || !context_settings.selected_template) {
toastr.info('No context template selected');
return;
}
const confirm = await callPopup('Are you sure?', 'confirm');
if (!confirm) {
return;
}
await deleteContextTemplate(context_settings.selected_template);
$(`#context_template option[value="${context_settings.selected_template}"]`).remove();
$('#context_template').trigger('change');
}
jQuery(() => {
$('#context_template_edit').on('click', openContextTemplateEditor);
$('#context_template').on('change', onContextTemplateChange);
$('#context_template_new').on('click', onNewContextTemplateClick);
$('#context_template_rename').on('click', onRenameContextTemplateClick);
$('#context_template_delete').on('click', onDeleteContextTemplateClick);
$(document).on('pointerup', '.template_parameters_list code', copyTemplateParameter);
})

View File

@ -8,6 +8,11 @@ const MODULE_NAME = 'backgrounds';
const METADATA_KEY = 'custom_background'; const METADATA_KEY = 'custom_background';
const UPDATE_INTERVAL = 1000; const UPDATE_INTERVAL = 1000;
function forceSetBackground(background) {
saveBackgroundMetadata(background);
setCustomBackground();
}
async function moduleWorker() { async function moduleWorker() {
if (hasCustomBackground()) { if (hasCustomBackground()) {
$('#unlock_background').show(); $('#unlock_background').show();
@ -167,4 +172,5 @@ $(document).ready(function () {
registerSlashCommand('lockbg', onLockBackgroundClick, ['bglock'], " locks a background for the currently selected chat", true, true); registerSlashCommand('lockbg', onLockBackgroundClick, ['bglock'], " locks a background for the currently selected chat", true, true);
registerSlashCommand('unlockbg', onUnlockBackgroundClick, ['bgunlock'], ' unlocks a background for the currently selected chat', true, true); registerSlashCommand('unlockbg', onUnlockBackgroundClick, ['bgunlock'], ' unlocks a background for the currently selected chat', true, true);
registerSlashCommand('autobg', autoBackgroundCommand, ['bgauto'], ' automatically changes the background based on the chat context using the AI request prompt', true, true); registerSlashCommand('autobg', autoBackgroundCommand, ['bgauto'], ' automatically changes the background based on the chat context using the AI request prompt', true, true);
window['forceSetBackground'] = forceSetBackground;
}); });

View File

@ -40,6 +40,7 @@ const generationMode = {
NOW: 4, NOW: 4,
FACE: 5, FACE: 5,
FREE: 6, FREE: 6,
BACKGROUND: 7,
} }
const modeLabels = { const modeLabels = {
@ -49,6 +50,7 @@ const modeLabels = {
[generationMode.SCENARIO]: 'Scenario ("The Whole Story")', [generationMode.SCENARIO]: 'Scenario ("The Whole Story")',
[generationMode.NOW]: 'Last Message', [generationMode.NOW]: 'Last Message',
[generationMode.RAW_LAST]: 'Raw Last Message', [generationMode.RAW_LAST]: 'Raw Last Message',
[generationMode.BACKGROUND]: 'Background',
} }
const triggerWords = { const triggerWords = {
@ -58,6 +60,7 @@ const triggerWords = {
[generationMode.RAW_LAST]: ['raw_last'], [generationMode.RAW_LAST]: ['raw_last'],
[generationMode.NOW]: ['last'], [generationMode.NOW]: ['last'],
[generationMode.FACE]: ['face'], [generationMode.FACE]: ['face'],
[generationMode.BACKGROUND]: ['background'],
} }
const promptTemplates = { const promptTemplates = {
@ -94,6 +97,7 @@ const promptTemplates = {
'(location),(character list by gender),(primary action), (relative character position) POV, (character 1's description and actions), (character 2's description and actions)']`, '(location),(character list by gender),(primary action), (relative character position) POV, (character 1's description and actions), (character 2's description and actions)']`,
[generationMode.RAW_LAST]: "[Pause your roleplay and provide ONLY the last chat message string back to me verbatim. Do not write anything after the string. Do not roleplay at all in your response. Do not continue the roleplay story.]", [generationMode.RAW_LAST]: "[Pause your roleplay and provide ONLY the last chat message string back to me verbatim. Do not write anything after the string. Do not roleplay at all in your response. Do not continue the roleplay story.]",
[generationMode.BACKGROUND]: "[Pause your roleplay and provide a detailed description of {{char}}'s surroundings in the form of a comma-delimited list of keywords and phrases. The list must include all of the following items in this order: location, time of day, weather, lighting, and any other relevant details. Do not include descriptions of characters and non-visual qualities such as names, personality, movements, scents, mental traits, or anything which could not be seen in a still photograph. Do not write in full sentences. Prefix your description with the phrase 'background,'. Ignore the rest of the story when crafting this description. Do not roleplay as {{user}} when writing this description, and do not attempt to continue the story.]",
} }
const helpString = [ const helpString = [
@ -105,6 +109,7 @@ const helpString = [
`<li>${m(j(triggerWords[generationMode.SCENARIO]))} visual recap of the whole chat scenario</li>`, `<li>${m(j(triggerWords[generationMode.SCENARIO]))} visual recap of the whole chat scenario</li>`,
`<li>${m(j(triggerWords[generationMode.NOW]))} visual recap of the last chat message</li>`, `<li>${m(j(triggerWords[generationMode.NOW]))} visual recap of the last chat message</li>`,
`<li>${m(j(triggerWords[generationMode.RAW_LAST]))} visual recap of the last chat message with no summary</li>`, `<li>${m(j(triggerWords[generationMode.RAW_LAST]))} visual recap of the last chat message with no summary</li>`,
`<li>${m(j(triggerWords[generationMode.BACKGROUND]))} generate a background for this chat based on the chat's context</li>`,
'</ul>', '</ul>',
`Anything else would trigger a "free mode" to make SD generate whatever you prompted.<Br> `Anything else would trigger a "free mode" to make SD generate whatever you prompted.<Br>
example: '/sd apple tree' would generate a picture of an apple tree.`, example: '/sd apple tree' would generate a picture of an apple tree.`,
@ -159,6 +164,13 @@ async function loadSettings() {
extension_settings.sd.prompts = promptTemplates; extension_settings.sd.prompts = promptTemplates;
} }
// Insert missing templates
for (const [key, value] of Object.entries(promptTemplates)) {
if (extension_settings.sd.prompts[key] === undefined) {
extension_settings.sd.prompts[key] = value;
}
}
if (extension_settings.sd.character_prompts === undefined) { if (extension_settings.sd.character_prompts === undefined) {
extension_settings.sd.character_prompts = {}; extension_settings.sd.character_prompts = {};
} }
@ -554,9 +566,35 @@ async function generatePicture(_, trigger, message, callback) {
const context = getContext(); const context = getContext();
const prevSDHeight = extension_settings.sd.height; const prevSDHeight = extension_settings.sd.height;
if (generationType == generationMode.FACE) { const prevSDWidth = extension_settings.sd.width;
const aspectRatio = extension_settings.sd.width / extension_settings.sd.height;
// Face images are always portrait (pun intended)
if (generationType == generationMode.FACE && aspectRatio >= 1) {
// Round to nearest multiple of 64 // Round to nearest multiple of 64
extension_settings.sd.height = Math.round(extension_settings.sd.height * 1.5 / 64) * 64; extension_settings.sd.height = Math.round(extension_settings.sd.width * 1.5 / 64) * 64;
}
// Background images are always landscape
if (generationType == generationMode.BACKGROUND && aspectRatio <= 1) {
// Round to nearest multiple of 64
extension_settings.sd.width = Math.round(extension_settings.sd.height * 1.8 / 64) * 64;
const callbackOriginal = callback;
callback = function (prompt, base64Image) {
const imgUrl = `url(${base64Image})`;
if ('forceSetBackground' in window) {
forceSetBackground(imgUrl);
} else {
toastr.info('Background image will not be preserved.', '"Chat backgrounds" extension is disabled.');
$('#bg_custom').css('background-image', imgUrl);
}
if (typeof callbackOriginal === 'function') {
callbackOriginal(prompt, base64Image);
} else {
sendMessage(prompt, base64Image);
}
}
} }
try { try {
@ -566,13 +604,14 @@ async function generatePicture(_, trigger, message, callback) {
context.deactivateSendButtons(); context.deactivateSendButtons();
hideSwipeButtons(); hideSwipeButtons();
await sendGenerationRequest(prompt, callback); await sendGenerationRequest(generationType, prompt, callback);
} catch (err) { } catch (err) {
console.trace(err); console.trace(err);
throw new Error('SD prompt text generation failed.') throw new Error('SD prompt text generation failed.')
} }
finally { finally {
extension_settings.sd.height = prevSDHeight; extension_settings.sd.height = prevSDHeight;
extension_settings.sd.width = prevSDWidth;
context.activateSendButtons(); context.activateSendButtons();
showSwipeButtons(); showSwipeButtons();
} }
@ -605,16 +644,20 @@ async function generatePrompt(quiet_prompt) {
return processReply(reply); return processReply(reply);
} }
async function sendGenerationRequest(prompt, callback) { async function sendGenerationRequest(generationType, prompt, callback) {
const prefix = generationType !== generationMode.BACKGROUND
? combinePrefixes(extension_settings.sd.prompt_prefix, getCharacterPrefix())
: extension_settings.sd.prompt_prefix;
if (extension_settings.sd.horde) { if (extension_settings.sd.horde) {
await generateHordeImage(prompt, callback); await generateHordeImage(prompt, prefix, callback);
} else { } else {
await generateExtrasImage(prompt, callback); await generateExtrasImage(prompt, prefix, callback);
} }
} }
async function generateExtrasImage(prompt, callback) { async function generateExtrasImage(prompt, prefix, callback) {
console.log(extension_settings.sd); console.debug(extension_settings.sd);
const url = new URL(getApiUrl()); const url = new URL(getApiUrl());
url.pathname = '/api/image'; url.pathname = '/api/image';
const result = await doExtrasFetch(url, { const result = await doExtrasFetch(url, {
@ -627,7 +670,7 @@ async function generateExtrasImage(prompt, callback) {
scale: extension_settings.sd.scale, scale: extension_settings.sd.scale,
width: extension_settings.sd.width, width: extension_settings.sd.width,
height: extension_settings.sd.height, height: extension_settings.sd.height,
prompt_prefix: combinePrefixes(extension_settings.sd.prompt_prefix, getCharacterPrefix()), prompt_prefix: prefix,
negative_prompt: extension_settings.sd.negative_prompt, negative_prompt: extension_settings.sd.negative_prompt,
restore_faces: !!extension_settings.sd.restore_faces, restore_faces: !!extension_settings.sd.restore_faces,
enable_hr: !!extension_settings.sd.enable_hr, enable_hr: !!extension_settings.sd.enable_hr,
@ -644,7 +687,7 @@ async function generateExtrasImage(prompt, callback) {
} }
} }
async function generateHordeImage(prompt, callback) { async function generateHordeImage(prompt, prefix, callback) {
const result = await fetch('/horde_generateimage', { const result = await fetch('/horde_generateimage', {
method: 'POST', method: 'POST',
headers: getRequestHeaders(), headers: getRequestHeaders(),
@ -655,7 +698,7 @@ async function generateHordeImage(prompt, callback) {
scale: extension_settings.sd.scale, scale: extension_settings.sd.scale,
width: extension_settings.sd.width, width: extension_settings.sd.width,
height: extension_settings.sd.height, height: extension_settings.sd.height,
prompt_prefix: combinePrefixes(extension_settings.sd.prompt_prefix, getCharacterPrefix()), prompt_prefix: prefix,
negative_prompt: extension_settings.sd.negative_prompt, negative_prompt: extension_settings.sd.negative_prompt,
model: extension_settings.sd.model, model: extension_settings.sd.model,
nsfw: extension_settings.sd.horde_nsfw, nsfw: extension_settings.sd.horde_nsfw,
@ -680,6 +723,7 @@ async function sendMessage(prompt, image) {
name: context.groupId ? systemUserName : context.name2, name: context.groupId ? systemUserName : context.name2,
is_system: context.groupId ? true : false, is_system: context.groupId ? true : false,
is_user: false, is_user: false,
is_system: true,
is_name: true, is_name: true,
send_date: timestampToMoment(Date.now()).format('LL LT'), send_date: timestampToMoment(Date.now()).format('LL LT'),
mes: context.groupId ? p(messageText) : messageText, mes: context.groupId ? p(messageText) : messageText,
@ -715,6 +759,7 @@ function addSDGenButtons() {
<li class="list-group-item" id="sd_world" data-value="world">The Whole Story</li> <li class="list-group-item" id="sd_world" data-value="world">The Whole Story</li>
<li class="list-group-item" id="sd_last" data-value="last">The Last Message</li> <li class="list-group-item" id="sd_last" data-value="last">The Last Message</li>
<li class="list-group-item" id="sd_raw_last" data-value="raw_last">Raw Last Message</li> <li class="list-group-item" id="sd_raw_last" data-value="raw_last">Raw Last Message</li>
<li class="list-group-item" id="sd_background" data-value="background">Background</li>
</ul> </ul>
</div>`; </div>`;
@ -797,7 +842,7 @@ async function sdMessageButton(e) {
message.extra.title = prompt; message.extra.title = prompt;
console.log('Regenerating an image, using existing prompt:', prompt); console.log('Regenerating an image, using existing prompt:', prompt);
await sendGenerationRequest(prompt, saveGeneratedImage); await sendGenerationRequest(generationMode.FREE, prompt, saveGeneratedImage);
} }
else { else {
console.log("doing /sd raw last"); console.log("doing /sd raw last");
@ -828,36 +873,22 @@ async function sdMessageButton(e) {
}; };
$("#sd_dropdown [id]").on("click", function () { $("#sd_dropdown [id]").on("click", function () {
var id = $(this).attr("id"); const id = $(this).attr("id");
if (id == "sd_you") { const idParamMap = {
console.log("doing /sd you"); "sd_you": "you",
generatePicture('sd', 'you'); "sd_face": "face",
} "sd_me": "me",
"sd_world": "scene",
"sd_last": "last",
"sd_raw_last": "raw_last",
"sd_background": "background"
};
else if (id == "sd_face") { const param = idParamMap[id];
console.log("doing /sd face");
generatePicture('sd', 'face');
} if (param) {
console.log("doing /sd " + param)
else if (id == "sd_me") { generatePicture('sd', param);
console.log("doing /sd me");
generatePicture('sd', 'me');
}
else if (id == "sd_world") {
console.log("doing /sd scene");
generatePicture('sd', 'scene');
}
else if (id == "sd_last") {
console.log("doing /sd last");
generatePicture('sd', 'last');
}
else if (id == "sd_raw_last") {
console.log("doing /sd raw last");
generatePicture('sd', 'raw_last');
} }
}); });

View File

@ -14,6 +14,7 @@ const UPDATE_INTERVAL = 1000;
let inApiCall = false; let inApiCall = false;
let charactersList = []; // Updated with module worker let charactersList = []; // Updated with module worker
let coquiApiModels = {}; // Initialized only once let coquiApiModels = {}; // Initialized only once
let coquiApiModelsFull = {}; // Initialized only once
let coquiLocalModels = []; // Initialized only once let coquiLocalModels = []; // Initialized only once
let coquiLocalModelsReceived = false; let coquiLocalModelsReceived = false;
/* /*
@ -104,7 +105,8 @@ class CoquiTtsProvider {
<label for="coqui_model_origin">Models:</label> <label for="coqui_model_origin">Models:</label>
<select id="coqui_model_origin">gpu_mode <select id="coqui_model_origin">gpu_mode
<option value="none">Select Origin</option> <option value="none">Select Origin</option>
<option value="coqui-api">Coqui API</option> <option value="coqui-api">Coqui API (Tested)</option>
<option value="coqui-api-full">Coqui API (Experimental)</option>
<option value="local">My Models</option> <option value="local">My Models</option>
</select> </select>
@ -128,8 +130,7 @@ class CoquiTtsProvider {
<span id="coqui_api_model_install_status">Model installed on extras server</span> <span id="coqui_api_model_install_status">Model installed on extras server</span>
<input id="coqui_api_model_install_button" class="menu_button" type="button" value="Install" /> <input id="coqui_api_model_install_button" class="menu_button" type="button" value="Install" />
</div> </div>
<div id="coqui_local_model_div"> <div id="coqui_local_model_div">
<select id="coqui_local_model_name"> <select id="coqui_local_model_name">
<!-- Populated by JS and request --> <!-- Populated by JS and request -->
@ -187,23 +188,43 @@ class CoquiTtsProvider {
// Load coqui-api settings from json file // Load coqui-api settings from json file
fetch("/scripts/extensions/tts/coqui_api_models_settings.json") fetch("/scripts/extensions/tts/coqui_api_models_settings.json")
.then(response => response.json()) .then(response => response.json())
.then(json => { .then(json => {
coquiApiModels = json; coquiApiModels = json;
console.debug(DEBUG_PREFIX, "initialized coqui-api model list to", coquiApiModels); console.debug(DEBUG_PREFIX,"initialized coqui-api model list to", coquiApiModels);
/*
$('#coqui_api_language')
.find('option')
.remove()
.end()
.append('<option value="none">Select model language</option>')
.val('none');
$('#coqui_api_language') for(let language in coquiApiModels) {
.find('option') $("#coqui_api_language").append(new Option(languageLabels[language],language));
.remove() console.log(DEBUG_PREFIX,"added language",language);
.end() }*/
.append('<option value="none">Select model language</option>') });
.val('none');
for (let language in coquiApiModels) { // Load coqui-api FULL settings from json file
$("#coqui_api_language").append(new Option(languageLabels[language], language)); fetch("/scripts/extensions/tts/coqui_api_models_settings_full.json")
console.log(DEBUG_PREFIX, "added language", language); .then(response => response.json())
} .then(json => {
}); coquiApiModelsFull = json;
console.debug(DEBUG_PREFIX,"initialized coqui-api full model list to", coquiApiModelsFull);
/*
$('#coqui_api_full_language')
.find('option')
.remove()
.end()
.append('<option value="none">Select model language</option>')
.val('none');
for(let language in coquiApiModelsFull) {
$("#coqui_api_full_language").append(new Option(languageLabels[language],language));
console.log(DEBUG_PREFIX,"added language",language);
}*/
});
} }
updateVoiceMap() { updateVoiceMap() {
@ -292,13 +313,17 @@ class CoquiTtsProvider {
const model_label = tokens[1]; const model_label = tokens[1];
const model_id = "tts_models/" + model_language + "/" + model_dataset + "/" + model_label const model_id = "tts_models/" + model_language + "/" + model_dataset + "/" + model_label
if (model_setting_language == null & "languages" in coquiApiModels[model_language][model_dataset][model_label]) { let modelDict = coquiApiModels
toastr.error(`Model language not selected, please select one.`, DEBUG_PREFIX + " voice mapping model language", { timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }); if (model_origin == "coqui-api-full")
modelDict = coquiApiModelsFull
if (model_setting_language == null & "languages" in modelDict[model_language][model_dataset][model_label]) {
toastr.error(`Model language not selected, please select one.`, DEBUG_PREFIX+" voice mapping model language", { timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true });
return; return;
} }
if (model_setting_speaker == null & "speakers" in coquiApiModels[model_language][model_dataset][model_label]) { if (model_setting_speaker == null & "speakers" in modelDict[model_language][model_dataset][model_label]) {
toastr.error(`Model speaker not selected, please select one.`, DEBUG_PREFIX + " voice mapping model speaker", { timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true }); toastr.error(`Model speaker not selected, please select one.`, DEBUG_PREFIX+" voice mapping model speaker", { timeOut: 10000, extendedTimeOut: 20000, preventDuplicates: true });
return; return;
} }
@ -349,10 +374,48 @@ class CoquiTtsProvider {
$("#coqui_local_model_div").hide(); $("#coqui_local_model_div").hide();
$("#coqui_api_model_div").hide(); $("#coqui_api_model_div").hide();
} }
// show coqui model list // show coqui model selected list (SAFE)
if (model_origin == "coqui-api") { if (model_origin == "coqui-api") {
$("#coqui_local_model_div").hide(); $("#coqui_local_model_div").hide();
$('#coqui_api_language')
.find('option')
.remove()
.end()
.append('<option value="none">Select model language</option>')
.val('none');
for(let language in coquiApiModels) {
let languageLabel = language
if (language in languageLabels)
languageLabel = languageLabels[language]
$("#coqui_api_language").append(new Option(languageLabel,language));
console.log(DEBUG_PREFIX,"added language",languageLabel,"(",language,")");
}
$("#coqui_api_model_div").show();
}
// show coqui model full list (UNSAFE)
if (model_origin == "coqui-api-full") {
$("#coqui_local_model_div").hide();
$('#coqui_api_language')
.find('option')
.remove()
.end()
.append('<option value="none">Select model language</option>')
.val('none');
for(let language in coquiApiModelsFull) {
let languageLabel = language
if (language in languageLabels)
languageLabel = languageLabels[language]
$("#coqui_api_language").append(new Option(languageLabel,language));
console.log(DEBUG_PREFIX,"added language",languageLabel,"(",language,")");
}
$("#coqui_api_model_div").show(); $("#coqui_api_model_div").show();
} }
@ -385,8 +448,12 @@ class CoquiTtsProvider {
.append('<option value="none">Select model</option>') .append('<option value="none">Select model</option>')
.val('none'); .val('none');
for (let model_dataset in coquiApiModels[model_language]) let modelDict = coquiApiModels
for (let model_name in coquiApiModels[model_language][model_dataset]) { if (model_origin == "coqui-api-full")
modelDict = coquiApiModelsFull
for(let model_dataset in modelDict[model_language])
for(let model_name in modelDict[model_language][model_dataset]) {
const model_id = model_dataset + "/" + model_name const model_id = model_dataset + "/" + model_name
const model_label = model_name + " (" + model_dataset + " dataset)" const model_label = model_name + " (" + model_dataset + " dataset)"
$("#coqui_api_model_name").append(new Option(model_label, model_id)); $("#coqui_api_model_name").append(new Option(model_label, model_id));
@ -397,6 +464,7 @@ class CoquiTtsProvider {
throwIfModuleMissing(); throwIfModuleMissing();
resetModelSettings(); resetModelSettings();
$("#coqui_api_model_settings").hide(); $("#coqui_api_model_settings").hide();
const model_origin = $('#coqui_model_origin').val();
// No model selected // No model selected
if ($('#coqui_api_model_name').val() == "none") { if ($('#coqui_api_model_name').val() == "none") {
@ -411,7 +479,11 @@ class CoquiTtsProvider {
const model_dataset = tokens[0]; const model_dataset = tokens[0];
const model_name = tokens[1]; const model_name = tokens[1];
const model_settings = coquiApiModels[model_language][model_dataset][model_name] let modelDict = coquiApiModels
if (model_origin == "coqui-api-full")
modelDict = coquiApiModelsFull
const model_settings = modelDict[model_language][model_dataset][model_name]
if ("languages" in model_settings) { if ("languages" in model_settings) {
$("#coqui_api_model_settings").show(); $("#coqui_api_model_settings").show();
@ -455,8 +527,8 @@ class CoquiTtsProvider {
$("#coqui_api_model_install_status").show(); $("#coqui_api_model_install_status").show();
// Check if already installed and propose to do it otherwise // Check if already installed and propose to do it otherwise
const model_id = coquiApiModels[model_language][model_dataset][model_name]["id"] const model_id = modelDict[model_language][model_dataset][model_name]["id"]
console.debug(DEBUG_PREFIX, "Check if model is already installed", model_id); console.debug(DEBUG_PREFIX,"Check if model is already installed",model_id);
let result = await CoquiTtsProvider.checkmodel_state(model_id); let result = await CoquiTtsProvider.checkmodel_state(model_id);
result = await result.json(); result = await result.json();
const model_state = result["model_state"]; const model_state = result["model_state"];

View File

@ -0,0 +1,870 @@
{
"multilingual": {
"multi-dataset": {
"your_tts": {
"id": "tts_models/multilingual/multi-dataset/your_tts",
"languages": [
"en",
"fr-fr",
"pt-br"
],
"speakers": [
"female-en-5",
"female-en-5\n",
"female-pt-4\n",
"male-en-2",
"male-en-2\n",
"male-pt-3\n"
]
},
"bark": {
"id": "tts_models/multilingual/multi-dataset/bark"
}
}
},
"bg": {
"cv": {
"vits": {
"id": "tts_models/bg/cv/vits"
}
}
},
"cs": {
"cv": {
"vits": {
"id": "tts_models/cs/cv/vits"
}
}
},
"da": {
"cv": {
"vits": {
"id": "tts_models/da/cv/vits"
}
}
},
"et": {
"cv": {
"vits": {
"id": "tts_models/et/cv/vits"
}
}
},
"ga": {
"cv": {
"vits": {
"id": "tts_models/ga/cv/vits"
}
}
},
"en": {
"ek1": {
"tacotron2": {
"id": "tts_models/en/ek1/tacotron2"
}
},
"ljspeech": {
"tacotron2-DDC": {
"id": "tts_models/en/ljspeech/tacotron2-DDC"
},
"tacotron2-DDC_ph": {
"id": "tts_models/en/ljspeech/tacotron2-DDC_ph"
},
"glow-tts": {
"id": "tts_models/en/ljspeech/glow-tts"
},
"speedy-speech": {
"id": "tts_models/en/ljspeech/speedy-speech"
},
"tacotron2-DCA": {
"id": "tts_models/en/ljspeech/tacotron2-DCA"
},
"vits": {
"id": "tts_models/en/ljspeech/vits"
},
"vits--neon": {
"id": "tts_models/en/ljspeech/vits--neon"
},
"fast_pitch": {
"id": "tts_models/en/ljspeech/fast_pitch"
},
"overflow": {
"id": "tts_models/en/ljspeech/overflow"
},
"neural_hmm": {
"id": "tts_models/en/ljspeech/neural_hmm"
}
},
"vctk": {
"vits": {
"id": "tts_models/en/vctk/vits",
"speakers": [
"ED\n",
"p225",
"p226",
"p227",
"p228",
"p229",
"p230",
"p231",
"p232",
"p233",
"p234",
"p236",
"p237",
"p238",
"p239",
"p240",
"p241",
"p243",
"p244",
"p245",
"p246",
"p247",
"p248",
"p249",
"p250",
"p251",
"p252",
"p253",
"p254",
"p255",
"p256",
"p257",
"p258",
"p259",
"p260",
"p261",
"p262",
"p263",
"p264",
"p265",
"p266",
"p267",
"p268",
"p269",
"p270",
"p271",
"p272",
"p273",
"p274",
"p275",
"p276",
"p277",
"p278",
"p279",
"p280",
"p281",
"p282",
"p283",
"p284",
"p285",
"p286",
"p287",
"p288",
"p292",
"p293",
"p294",
"p295",
"p297",
"p298",
"p299",
"p300",
"p301",
"p302",
"p303",
"p304",
"p305",
"p306",
"p307",
"p308",
"p310",
"p311",
"p312",
"p313",
"p314",
"p316",
"p317",
"p318",
"p323",
"p326",
"p329",
"p330",
"p333",
"p334",
"p335",
"p336",
"p339",
"p340",
"p341",
"p343",
"p345",
"p347",
"p351",
"p360",
"p361",
"p362",
"p363",
"p364",
"p374",
"p376"
]
},
"fast_pitch": {
"id": "tts_models/en/vctk/fast_pitch",
"speakers": [
"VCTK_p225",
"VCTK_p226",
"VCTK_p227",
"VCTK_p228",
"VCTK_p229",
"VCTK_p230",
"VCTK_p231",
"VCTK_p232",
"VCTK_p233",
"VCTK_p234",
"VCTK_p236",
"VCTK_p237",
"VCTK_p238",
"VCTK_p239",
"VCTK_p240",
"VCTK_p241",
"VCTK_p243",
"VCTK_p244",
"VCTK_p245",
"VCTK_p246",
"VCTK_p247",
"VCTK_p248",
"VCTK_p249",
"VCTK_p250",
"VCTK_p251",
"VCTK_p252",
"VCTK_p253",
"VCTK_p254",
"VCTK_p255",
"VCTK_p256",
"VCTK_p257",
"VCTK_p258",
"VCTK_p259",
"VCTK_p260",
"VCTK_p261",
"VCTK_p262",
"VCTK_p263",
"VCTK_p264",
"VCTK_p265",
"VCTK_p266",
"VCTK_p267",
"VCTK_p268",
"VCTK_p269",
"VCTK_p270",
"VCTK_p271",
"VCTK_p272",
"VCTK_p273",
"VCTK_p274",
"VCTK_p275",
"VCTK_p276",
"VCTK_p277",
"VCTK_p278",
"VCTK_p279",
"VCTK_p280",
"VCTK_p281",
"VCTK_p282",
"VCTK_p283",
"VCTK_p284",
"VCTK_p285",
"VCTK_p286",
"VCTK_p287",
"VCTK_p288",
"VCTK_p292",
"VCTK_p293",
"VCTK_p294",
"VCTK_p295",
"VCTK_p297",
"VCTK_p298",
"VCTK_p299",
"VCTK_p300",
"VCTK_p301",
"VCTK_p302",
"VCTK_p303",
"VCTK_p304",
"VCTK_p305",
"VCTK_p306",
"VCTK_p307",
"VCTK_p308",
"VCTK_p310",
"VCTK_p311",
"VCTK_p312",
"VCTK_p313",
"VCTK_p314",
"VCTK_p316",
"VCTK_p317",
"VCTK_p318",
"VCTK_p323",
"VCTK_p326",
"VCTK_p329",
"VCTK_p330",
"VCTK_p333",
"VCTK_p334",
"VCTK_p335",
"VCTK_p336",
"VCTK_p339",
"VCTK_p340",
"VCTK_p341",
"VCTK_p343",
"VCTK_p345",
"VCTK_p347",
"VCTK_p351",
"VCTK_p360",
"VCTK_p361",
"VCTK_p362",
"VCTK_p363",
"VCTK_p364",
"VCTK_p374",
"VCTK_p376"
]
}
},
"sam": {
"tacotron-DDC": {
"id": "tts_models/en/sam/tacotron-DDC"
}
},
"blizzard2013": {
"capacitron-t2-c50": {
"id": "tts_models/en/blizzard2013/capacitron-t2-c50"
},
"capacitron-t2-c150_v2": {
"id": "tts_models/en/blizzard2013/capacitron-t2-c150_v2"
}
},
"multi-dataset": {
"tortoise-v2": {
"id": "tts_models/en/multi-dataset/tortoise-v2"
}
},
"jenny": {
"jenny": {
"id": "tts_models/en/jenny/jenny"
}
}
},
"es": {
"mai": {
"tacotron2-DDC": {
"id": "tts_models/es/mai/tacotron2-DDC"
}
},
"css10": {
"vits": {
"id": "tts_models/es/css10/vits"
}
}
},
"fr": {
"mai": {
"tacotron2-DDC": {
"id": "tts_models/fr/mai/tacotron2-DDC"
}
},
"css10": {
"vits": {
"id": "tts_models/fr/css10/vits"
}
}
},
"uk": {
"mai": {
"glow-tts": {
"id": "tts_models/uk/mai/glow-tts"
},
"vits": {
"id": "tts_models/uk/mai/vits"
}
}
},
"zh-CN": {
"baker": {
"tacotron2-DDC-GST": {
"id": "tts_models/zh-CN/baker/tacotron2-DDC-GST"
}
}
},
"nl": {
"mai": {
"tacotron2-DDC": {
"id": "tts_models/nl/mai/tacotron2-DDC"
}
},
"css10": {
"vits": {
"id": "tts_models/nl/css10/vits"
}
}
},
"de": {
"thorsten": {
"tacotron2-DCA": {
"id": "tts_models/de/thorsten/tacotron2-DCA"
},
"vits": {
"id": "tts_models/de/thorsten/vits"
},
"tacotron2-DDC": {
"id": "tts_models/de/thorsten/tacotron2-DDC"
}
},
"css10": {
"vits-neon": {
"id": "tts_models/de/css10/vits-neon"
}
}
},
"ja": {
"kokoro": {
"tacotron2-DDC": {
"id": "tts_models/ja/kokoro/tacotron2-DDC"
}
}
},
"tr": {
"common-voice": {
"glow-tts": {
"id": "tts_models/tr/common-voice/glow-tts"
}
}
},
"it": {
"mai_female": {
"glow-tts": {
"id": "tts_models/it/mai_female/glow-tts"
},
"vits": {
"id": "tts_models/it/mai_female/vits"
}
},
"mai_male": {
"glow-tts": {
"id": "tts_models/it/mai_male/glow-tts"
},
"vits": {
"id": "tts_models/it/mai_male/vits"
}
}
},
"ewe": {
"openbible": {
"vits": {
"id": "tts_models/ewe/openbible/vits"
}
}
},
"hau": {
"openbible": {
"vits": {
"id": "tts_models/hau/openbible/vits"
}
}
},
"lin": {
"openbible": {
"vits": {
"id": "tts_models/lin/openbible/vits"
}
}
},
"tw_akuapem": {
"openbible": {
"vits": {
"id": "tts_models/tw_akuapem/openbible/vits"
}
}
},
"tw_asante": {
"openbible": {
"vits": {
"id": "tts_models/tw_asante/openbible/vits"
}
}
},
"yor": {
"openbible": {
"vits": {
"id": "tts_models/yor/openbible/vits"
}
}
},
"hu": {
"css10": {
"vits": {
"id": "tts_models/hu/css10/vits"
}
}
},
"el": {
"cv": {
"vits": {
"id": "tts_models/el/cv/vits"
}
}
},
"fi": {
"css10": {
"vits": {
"id": "tts_models/fi/css10/vits"
}
}
},
"hr": {
"cv": {
"vits": {
"id": "tts_models/hr/cv/vits"
}
}
},
"lt": {
"cv": {
"vits": {
"id": "tts_models/lt/cv/vits"
}
}
},
"lv": {
"cv": {
"vits": {
"id": "tts_models/lv/cv/vits"
}
}
},
"mt": {
"cv": {
"vits": {
"id": "tts_models/mt/cv/vits"
}
}
},
"pl": {
"mai_female": {
"vits": {
"id": "tts_models/pl/mai_female/vits"
}
}
},
"pt": {
"cv": {
"vits": {
"id": "tts_models/pt/cv/vits"
}
}
},
"ro": {
"cv": {
"vits": {
"id": "tts_models/ro/cv/vits"
}
}
},
"sk": {
"cv": {
"vits": {
"id": "tts_models/sk/cv/vits"
}
}
},
"sl": {
"cv": {
"vits": {
"id": "tts_models/sl/cv/vits"
}
}
},
"sv": {
"cv": {
"vits": {
"id": "tts_models/sv/cv/vits"
}
}
},
"ca": {
"custom": {
"vits": {
"id": "tts_models/ca/custom/vits",
"speakers": [
"00236e350cc84b94a6684f182acf96e68963d7fa1164d4fa56da20f46f210b2dd3ecf189e97fb3c94113a54c12dc20550508f5b7b9b37e1873898d58a308feb5",
"00459",
"00762",
"00983a845f95493fb27125b114c635f3b40060efaee167d32d8a3dd040c877713446c7bd3e6944641227bdb4165ecb8d684ec2ef66c817e65e77c52cc50e62ed",
"01591",
"02452",
"02689",
"02992",
"02f7d61edf5063ca42953b1068539f1572985aa9448555cfd8d7667121eeedc72c912d95cf33abf61a1f9620f2a01be4251a53aa5440d15849003fb31210d830",
"03115",
"03386",
"03655",
"03944",
"04247",
"04484",
"04787",
"04910",
"05147",
"056d7638d714a7dc1efe1c47d390d0659fbfdfc7df5249e8bfe10ba346cc76d5cda93fc8ecbeadffd4924c4f9cfb6b32c1739c8af1e2d58d7cec88b2cf18795f",
"05739",
"06008",
"06042",
"06279",
"06311",
"06582",
"06705",
"06942",
"06c6d2e093624103c268e2cba37466147fd564bff1312a78d1c5be9ba168af4cf4819c7a91d5321d7aa9bd20ad6c702ca2cb005496dd20c45d293200b2b8a7b9",
"07140",
"07245",
"07803",
"08001",
"08106",
"085503e68b0772f1b3aa4de86a57bb26e3750660e7929a14a653c729787a110cc8b3704f8ea09842f72be46b6ffbb35bdb3732308b31dceefc3b33e5ad3f7975",
"08664",
"08935",
"08967",
"09204",
"09598",
"09901",
"0befb1084ad00d656f45a87ad83f074c61e3b3767cf6f5463fd5bc199ab7fd4733c5f02e3a100359e953977cc2a2689bd4824ef6e3178a7108cb45a0204fb3cb",
"0c6bf67821762116d753c9b48ebed8a2ccfa0a956d5dbf19feb0ac0bc2096154ca288ae7c5e324a3092db395cc24c64c6a4e4fb0e01429b7343cafc7ac1b2e13",
"0d0a943d348b4f0948da443c4d020b2e690731955ce8c318c0fb72663cfec3cd3458488ff9ff9cee6d221c85771b8eb83cc087dda37d4109bbb1614039e5f565",
"0da83aed14276e120e2581be32891bb088a22c272feb6f03b4bac1b827cccdbc8fee277a885f58e98931819e0d6171526c5fa7b2e788f68a2852e4d5314f613b",
"0ff19536d6147f61b24d50c0c993a7a687df4d253c2052e4fa30b1624c87e60075649d888f51ce71318fb8789cb378879091aba020256d66ac19f024833c3e63",
"125d9d1721de26a9b89d0e4f4d386e07458d287ebb2f338879e8886847abe6b3209f79e2bc335bcfc437350184df5a7d9e1a08ffb5239674edfd1cf95a9d1e24",
"1378866a4d2b6965c03eed8e48e03fffd089638acdf1fa82ed20a9856406e083f0c0e1f5043c4d3bf67dbc383f7cd28b602eff1d8bd8bf8c1a0191dc98540322",
"14bc32c10eb26503a4e799c3a762bfe5949d7a232074e854ecfad8139acaa4257c563a502e06a263f2d5fa8337114a9741d4a634a0f914adae74e5f9a80f145f",
"151fcb1168f41a51c49e20b426605109e1d9dd50be2926aa9878040fe325eba2f2c470357a735e9e24b7412e78e2550a8fbd0ea77fed80e4d8f50a21f2064948",
"1610e29603954ee12f408eaeb83a5c99781b5efe5f64fdf2e3c5e0ba9756b5b11bfeefda40a787842f7d5da653135043e3f43e7f786499cb51ad6181ef8acc9d",
"1887c37f4187a4c3213ba4b58d0ef15f903a3720ee94d5ce59c33db193f60db416a4d9607f213ae44ca3eafc7217fb9871e2ee1837ad4cc0f34794e5c543f9f5",
"1add23d44d2d913f0ea6e061fe292b0563653fa15b4ecc9cce0c2b83dc5a743d6d3dd4625efa112f751852c348a667a9456ef3486ae7e8c5954dedc69f998ea2",
"1b7fc0c4e437188bdf1b03ed21d45b780b525fd0dc3900b9759d0755e34bc25e31d64e69c5bd547ed0eda67d104fc0d658b8ec78277810830167c53ef8ced24b",
"1b8354b1fe9255578225b3d2255d5e781eed7d13ab61e84bc08be5d6465ec468c533563137ca756fcb7d3759af0ac2c0b4d00873782c7bf47ea72fd9be2f9e8c",
"1be6c773da6334cc73e23312689bc8a5915529c905e1d5289dbfe00332a7dcb9ae97efe209635e2e5040783777409155926d231a5a5f76357494671512d2b1a4",
"1c7af1cc1357fd63bd9ffe915745e20c34588438e1e0d85fdc8c9de4b3bd41d3d61b318b6a69862c6d64dd41f15ef3d994a6bb6c9a9dac69c891308b09ab16a5",
"1c7f19a7fa0b166c700bac583b6858ce7adbe19566d66e530953273aae59776757aebaeb30c20a58d74bc50ce1345516af5bbd36168f443fed809bf54c02f63c",
"1c80e9d982aa0c12db8498e8275b2281e638e8e5c684a752e19f8f9842979b70a3624785d0c30e0e57112950cae5e892bf554c295c74cf8c82c8ec33c732d8c6",
"2256cc5ee6c617347af9a1abd97dfe80f55e6691eb0a042321d46a1bd7ce0baf1c7a4c8ea3fe4184f8638b1c3d9e83b6aa193bd6f9b49d5358523f1fe324cd92",
"238532dddf77923ce93cf2e9ed809d088094106a1aad327e8a7b229ce24a339771e59478f7d5162efc1da6f347b44cbb2273ac9154aa3a76c7a8fc458470cc2b",
"241ca4fdf2124f550657446301fb8dfc8bdef46d3888ce39bf9d8622c2bbec7e06b198f5e33fadbf30e477fdb37435cea36d10341af1a7d3a80d0ad1caa94bf9",
"2421aa51a089ecfe45250bf284d5690a9994a9eb03f2ba4f43d2ad73fe78783ae5f3d3088d772e01fd1d747b2ecd6bb1bfae5feb10a72130d3952ba7304d5c53",
"24d967d0e8b84beb3652417724be81ab83c7834afaa7b7d3d7d9591b1a2a7bb75f9b25be548a200570ebd6cc34e91306b675af510ef91cd34a77060b65b9faaa",
"25911630ab15956e81427d3e990cf37f79490e305914a15ca7dd7b95dd4d4feb15fd94549cc005376801ce68d637eab6e19ee36017dba5c01bd0f206e5e8dc3b",
"26099adbc4db8fcf000e2c7d1da3399662281f9af03831808d29c602431af4fc13f21b38c5c42c5ac4f77ece48448eef99f735d92cdaed857d19da7dd2b888ad",
"28e2fe1944a593c44c3de0dc52971f040f0b8901fced2057025bdbafa1fe3b042be19618044ae085d7364e3cb38601e9ce4030329f15af7a0898f9d4c2c5014f",
"2b59e9f830e5ea00c500b63eff4e72553e0c2608f5741d35c226e733400412014d7697bd6efb67bc61b19fd61e40f9ed70fde2589fe0b5498915eebc1c8b5d93",
"2bc2a177bf56dcc98e05501e7bc6eebd3d1662114764299a4f9e6b060a48095b8ec95d20a5814f71343d65ee3cd2e7f42a80faa51a148005242cc5073e605ba4",
"2ce84c6ea6aae52c449b6d34cbc095b2f2c3e6fa20d0e48b2f7d223724ae01375e92a8ad106b029f0562ee735de36d9bca6cd167257c3f68796bd8b1a0ab600f",
"2d84f39c2cca33dd28fee650caa022c9a06407462342fae8dc256af7904cdd114af5b4cc883181407b8dcf2dc4a93d45c62c83a317d84e876cf710a521f20d80",
"2e6ccdf9f0a7bf0df6fd0572bbb53f25378fc5333b352bc885b3a0d01e5dd672156cf697c127cc998ac546d122c547c421970a6f23dccb60bf2c841146fa6576",
"2f92b4704080216aa80b1b39cfa223feeb9ed7c909f5b77be1b6e45fdc8827463bc4c4cd98263f02b57e653ecc2ccc7192aedd92990113433077e7ed44eb1e0a",
"2fb95c3b786fa65215534207266e034b294317b2327ee0928be3436258e42db8f4479e86e6006979ec4438dbaa9daa05be21ddc66717d30dc43e36ead349965e",
"30b1f81c579755895581259d79a8a5a3ca45b908b0bd14ad1c6418f39aa1e2f47cb4749c69b5440cdb92e3bafb772e19e7bc2b16d196b061addd173a1309e491",
"31535cb2ece4710d08fdbeefb6f8f75ed093fee4cf8573bd601d960f8c6156f0fd0a85712761691e86e31160b993ee0eacb10c4c8aed000cc394cf7c7d207a7e",
"31e6f3a011661320b2e59b6f8be43f6db2243e9feabc2b9787c1413788e13eb0e5810bed983bf7ff66e46417d183a91ed50b3b9be9d89e4f51aada72293b9881",
"32550810ba55b9a67a25d308f0ede521f12cbf6076472ff5bd60a8f5e951c481b784e2f04194fb96116c4f001d84b3993b2c580879671de46333d5f212ff2ca5",
"336f82b4645b80c99137018e69bb6f8138a9c8dc05a510e36922503120648625674e1414cd90d0cf46f28cbd5993ae0eaedc9994b72e8eb5242737ddefc0bfb2",
"35b962b08846ed7d8a4cc47582a4e607f5ff4136042ce0b1adb55d1e8d58e2dc1abc5807b3601a7f7be1ada5939e1771e128fc916c1b5d39ed3619e251707952",
"3637902e0d19f0080313c14d2c9dcde800ec6b71d493459c2f3b2cebf186f028ea289dd59ba1fd4705e53891216f7f4c36dbcb8938aeeaf142317b441b20a837",
"3723bd65a05afc7411c2bfca904742062b7b0c081ba126e68c65d28eaa6122f69196f4959fc1795fe03f8e49ec7364863911f9b659684a06b3a126c6f1729551",
"373d86f9fa3a127372dd913b7571ed318bfea42173b2b7daebde93c742f3224fb7fe5306085e836d20bfee4201bfe070b4c6b36510f5c9f379f6a3b610f36cd0",
"379d321bff71ebcd34792e8f4552d341f30a006b4765f8c6de4fa98d3ca416def88adbcb0253f5849f51793b3d7ca7e53700ec70b5a97e84ccd1f35a2a1fb6e5",
"37c12c700c95dc0028b3b82c4cf1fb922d68680c35fe84585bf22674e71c4dc53bd9233ce8b71bd31e9c9b0e000d01d195a3572b9055a73fbec891b1ade250cf",
"3a4a32c7cff18f1896e7cbff2c19b4e6f91a95c1e7aab616722600ceb36a86b07fb0e1e0c70cc285dfb6192b53cb67826698b7f3f652549e27a969bde0177fa7",
"404ecea5ae8e5f4ec3d2c48494cf7f1d559268542d8f1f7928da2fcde55c9fa3f491ba632f555ec69e8c9e819072df450add7e5886cf5527f446b11544af7d05",
"41e5e21b3a3b0c8df01ba5b3c3e6224cc4082f41ca87679344b0273e2216cc272e19426c160f5a9580915c057a3e4000788be6cc7a6f5f346cad5068c7884ce7",
"464d9ac63f7958200bc09a141171355bf4f3631d66dc4bbfabd497619a8f055c034c0752987944b2102e02d4b435bcd3ce0527962871112049e1d26865b776e9",
"4869d94d4936ab700c5e5bc7b666177b53220082f5f221774b5625d7275cd4f117482dcd1498674b7f885fa41d86f99b8d00b6a6f641829780946651f561fc22",
"496b66c9cb705a46cdfef9eeaf29c9d738a4b70b601270985a7df5a06f9e1d6c56be0982995c8cc06902d0ee89bae201c37a91f568331ffe28ad2d150e183fed",
"49a7654071536ed5882b8b6e6d2e3558ef796ecd8aab8ceaa24ad8bc9f3420b528ef1413696584c11facd6d5bccd37fe8e274b8c3d139dc251ffb11c3a503aaa",
"4b6c7e4e9bde35c471cbf5e2e93b2eb8bbba52b710acecf99910af08b3b35365f24d883ddfdd9825918c31477a5f3fc48f075080c4e97e80fecd6e1936bc92eb",
"4bce212aca40bd1834bf741e47954526a8817ecbff8fedda854dbfc2d033a2567bd34b84fa02c3d07855f3dcf413590ae75ad6edf261d66bffb84d77803a7b76",
"4cedaa8d96436fd0d2ebdb61d616790a3cb3737d0a93d2ae41d588137c0d3339999d991b7b3c452704be1f5f512ce5a08c0971898fad0ad77f18fd623411cd7f",
"4d7e2548403c7e04d809030aa25015c9706e773517e1f72b81bdda22213aeb8f542cc62156bc5ef1c1622e99227fedbcc9c1b3e5e147b854e3b629f8f78bd158",
"4de9f262eee7ee7d24ef8933af4610a1c5b97ff055c4fd0f97868e338a017308d460f4b003b74bd2aba7789153593f3b986b814fd93f2e4dfa5b55594fb17c55",
"4e5e58a6ec7d9cac969f99b817f981ab7f8d2cbd9ab9dd0a37e45c70a8a8ca3b8e1c43b2013082062ffc1f4f3b268ea78ebb88d613d026a6312f40a6867a1d0b",
"4ec8f1e81d7abd9d2dcb3dbd4be86b615f643386f3b1098c37a02a103fe6b36239c05bff6746ce568ca81765b285c1c271af4fb1fd99120341cae2851b776bbb",
"4f57d1abde3364d91128e682ba724e6d3bc2ed6b112d2cd679739e478ea6bd671c527edff64c6a7b5c1173f68e02a410f09c2256356fde7d517908310c118382",
"503dbbe83f0154e9bba4bc685bf1c1fbdd27293d0e4f837947910e4d320bc4d5bed1ade67a45b541013189a2c133f6f9f6cbc3566fad220c0635f286feec74c5",
"51795e8ea8faa28e88f02559f6bdd47d9a0735589d47dd0f2e057b8b01fd3667fd9fd29e2613f200174af1d4b2d3d0860704cebebf2b6e79f1724d6782d7a270",
"52cfac480c0cbc60068305d983adbf98814d2cfddb8be0ccfeb7c7f95bdaf31a5f70da944cc2453e6a5fbb9bb4092e36b662e838762855fb016f55e6e3d957c1",
"537e815df93312978a9ba479ff2dffc9975c875950a203e8a1b7ffe4cb06625964f59dde1a06b87921a2a91702cc6bab04e159aec7cb2e2fc576cbe25838df2b",
"547dd49c2cbe113b60c9df4a8e8b83a532f0da054cea8f1d23db66cc2638f7b5edfee820b4764646be10dbcd05caa5d71483477718a73ce8dfc752204807d9e5",
"54f344faa37da0c9ab1ab563735c532ab81fcd1c8431cd8eca4ab7a8774f194e1ffe922547ea42bd1fad36e7493761992eca4821138ded1a9580e9fa38685291",
"56071bfe30e977f201fa4d6808f8d7c2f3e6788ba68d12e2eb18386ac2507bb2bbe3c14bab90370066bbf6e2af42afcf1e45b362dba958d38fbc69cdea3874ea",
"57e5f7cc5fac058f7c772eb41f8d49bd0fe3070c41eef445b1c073abf9b1cec451aa22764490b7da4c5bcacf4ee453c3153158cb1569f2f9447807cb14dc1126",
"5a9a6481f1365def2919871790a95fdccbae145640f3b4b5e11d1d1370ed35c5a4c31e402b3b438892a6bfd9dfbbe2fc97056d2cc24f2ac412b3a5e1adb7003a",
"5ba168675a3f2ea8d6d51896c5db84ee59ca65359b1b97e6d79543a6c918fe427f8b6cec79037c452eb086debe1d57049c25481d61a873f0503703266bf0cb84",
"5da56ed896575439b7bbca20981f0b50618958d94f08b8f47d13774dca3990d4c571be1f4aa2786bf8fcbd1a594336be49cc26d972d5fb0c0682ab4d5b59d19e",
"5ebf04dfec6c9b10a6fe7fd03725901973565a13530c20d02b4332670cce9beab185dd0b0f61f4a87f9c3dacc307d06e062d640f6550d9443a4c06a114e5bca5",
"620b0d4c3be90f5f77f0cf9f976e5d7f067689884dc857f2b26a6edb40ef4fd2826213b5028900b168e853d036f1741600b236e04d8dcae5fa26cd2b8975ac04",
"6323ec0401b28c1b06afa76760b478535101ae48c6c9367491087143287d9ff76b9c00f39dc838cdb20d65eab16622dc85143f5845791bf85705cb4f20975bbe",
"633e7303eae41420e558e186308510783f5c234e9c639c0e6f5b6d37fca6bab766c5d475b2f330910bac93cef6982124e73a1b6bab1a2e99a2e5d797f8547c6d",
"6688b60c24d068e19487c0b88a8b0a256854d8090ebebfa9a462fe49a77b8e9f303aa02042069cb0d6f227932cb48863758d0b57a18d53125ad39953bac543aa",
"6745c47d0bd557c3dbce201697e8a2fbaff9ca52744d6007a636a237b82d1167795a0c0e2e5eb71b7460ed16e3fdcdac1dba1b7a2910d5168416e236c93ccb76",
"6892c6ba9f66d0d7aa0445139081dc82a76d9ef8c7bb049a8eaf090f76c06cb4f1db05739038d7e04167569bb6d0fea55fc15343f7c77cd5a3e2d4c5ed068290",
"689a213fd2d66b9d3634c9165b316e49ec53ac96131be42226d462ef1bc3ba38651e94698fd6e6f5c6d6c834d2b9a6732be54a8d6273c1025511d795326ffd3e",
"696e8808717101399ab7ff16382db411adfadcd60c6a525539b0f8f88d84b448662fbca212b175379ff78ce7b2e64aa4b4e96d1820ade8eb2f742295f744db7c",
"6bdec6b6f7e6b5a187feb6537101d90cca1043e34d53e347f2f0b14e701585361fc4a4cd81577b6d4588844fc8bdba8af66155d9eb6c2eefd461e23d0b2b87e4",
"6e5948f904b3048511677d23d3cc9bd678739b234170302e1556c1bd1db8cee4243bf5e012a1320b4c50f6276e05cc5f620c461f640ac7413c23524f63f4aac3",
"7115c00371f891d0094a716083b978948431509a16d5a9598e78ec12712db46d46f1674312cd31339e2d6118cca5f7a3f82ec25dce861a059ee31d832cd6dcda",
"71b67ba5ec75978632136441a25426dbd48d4c0a55c1a5fc91f0f952b6bac06ab0d9709f0a7bb5a05393499135b76e4d722c7065fb636a227ba58c7fb86438eb",
"72a3d5bde83f60653937232cf4d29218ff5988533855fdbc804d9bea7e94eb14a8afbe36a8f8ee576a3ed2345632d4ad36df52efdd9adbdb60da6f890074c6b6",
"73d3685f3e78183724e3362f6c4288d522b54a8d2722197dc5ff5006974c1529dc562c1cbb05f023da4922cfc04340eb83b887c5343041febed1ddc44b22f9ed",
"74a679bf6c4a1b5856a25780496812416383f0567afcbd9b411ae9a0abab47d466741bd925b03decd7da586c6ea9589c8f40208ac2a22fa4413d4ea6e1a6f0dd",
"7638395f7d47fbf631633e2b899044e82e7ce0e07305114921cb0696551966b09993766782aaad70fa40a0f7362be31940381653c659fb73d3e1fd1fa45c257d",
"76383f56d9979837d4b3348f9f28877dd1ba58c1bd0ea839bdabf021428c2edfba46ff25558004c5183a73575eb126d4e0746a40e22ab15154d5d6f238a48ca5",
"77cd12af0a3d1d8cb64dd577bd2d50ac057d816694e8bc04089a6adb90e53ad6cbe9fe6aaf52596450e0c8178d8f9b88a545b27adcbc89bddf4d7c4bc4dd31fd",
"7834da277192e9434b0c039272ee6b3f1b225d2f975aa175fee762fb0d5f16b1edba2e0dbf11d8aa2bab5984482f703f88f0e9d1786a7687710ea2688f307ccd",
"79a830901c1bb0e27663dbe14d13df91d887daf0eabb6d3eee7f09768212afcd9cdde458d13042a9d2aa099f390c79ab94f2c1ca47fe0321f6c18973e437cdd6",
"7b7593f44cc6f9f7b21495bca6f3d564f73f36b97ee15d51a783da8141463834022996c55e494800d21304079aefa8a5fe64350c9273e0d36453b097b2dcc5f4",
"7c7d917d97412c24b76af336086469a43013d1d6b27298aa82c4e99b3f3b6c5a82014428a6a14b080a834382d9b0f178e405fb10170bcd340957955087698e19",
"7d19dccf48114d3ec00c45fe80581300faca042157d6c9458ec439c300d8c7b1190aa70eecf19f8b1d5af8c7291f3da08fc635a7fd6acc7c5b203d1e226589f5",
"7d8d6fa22ff724d823b82499686732b7fbf32f7c1f35dd5733ec3b65fa9625cf2d49bba86e6e0132252bea64074f35ff96a77bfa44441aed3fc1765b13cbc526",
"7e36be2204fe367a3798e1b2ff988779890591e5c997b1f6025ec8ee1fef3eb19e81b74bb8657874f5a990d5062d6c849621ce363c4a9c2c5a63c0966be6140c",
"7ff908cc2a18ec5a80e74fb4a2f12b406f0b7456ac797d35091d618c7ee991baa88edf62200817aa27732b03d9109cbdc6603092822b2e13a575953045b1cd0a",
"8154716e77acd0f5e912887facffc7b2c9889891e863a39fcfed1e5637e47328a4a3bf40bbac1e740629d3013304ada88cf24dbf3735a7aa2d4b855f813c8fd1",
"8162d651b6211f06f655a69cd7fdd383d6b4287e9ba132b9898ef9ac8687349e777626333d23bed93f9264aae965efb14ed650cb64fd0ad90494aff903eaef11",
"8348c81a253096a9def0b472a8499fc03ef8c6c6d3cc9b4a018f142501ebd04c2479008b88895e033eb83978e7d71e52a91a2e324ca869ed8f2724dfdcef269e",
"84b101db8d076398c1d624a8b38b22fbddbfa8fcc43ade44619f5a9b6e70daf1c963d6dc09ea039cca94ec56ccfd04a1689e806c970c0bd32cc9e56b73c7bd7b",
"853fb95e0f017c203e08312e3ccf45c0419928e08313b1bb0444aa4ff089550546e67fdd3434a22cae3f67603437051e49be5c4d8fc5583b1aa6a1ae36f0a911",
"85c9e13ccfc0d67de10281b04257d8ac0c256d2f9415e54148fb59954c0d43f66d3cbea43ea6389f8407a8bda8b1b1becd30e41dfbb3dd9bebbe69816d096fa9",
"85ea0b349a8df04283c62efb571d2947e7264b566883e300501086733b08efa42ced215bc47951c8198626f86ca8c0df730cdc35f4d99ffff958599884b68e51",
"88673d4f24d039e89c15d9ede6b653e41e42ca8bd7a8cb7e92a4f235e9b56cbad6200f8dc313c644e9a7d8d1dbc2b7e988da93bc0765499701bca6bc86d8fe3d",
"88ec4ff5a1b0ffdabfe62d068286c851ee64c428883e56f32af14b59756d5846be9d46e5a777c4c22f2dec9596a1a44ed3aa75f1fb0231923cbd4ab59f1f9c47",
"892bf89bd3a008a7d982de0d278349e654c713efacf965e88e46a12398375cd8502711378e378c39c33b2f995f47799760c6e6e05948b93c0d2b9fd427854ffc",
"894bd433b4b06514195a604961c871649e108d210a41d5cbebe76f78cb6270b7708d1c59d6cb88807f882bb154be1c9058a753e2b6a95c3f4ac9e27a02036f12",
"896256329fbeb5b8116349c31d8a39a7d36d5f970d48558e1db5417d611e240e4dbf473f6e49137f7aa6116394b7deabb0bbec4a014896cdc9484ee91458117d",
"897c3401b4a35d8fad5966bf8c4dce6d94837c76e46e8131a8bd70527f6e1d8c9f59053d0a56425d7dee71939280ac3c38df14e976f613cb906d7187d6141297",
"89e6f6a865ab743936a9b29d53b67bf4b68660ccbe834d4a11fa9011edb535e3b7b4d7a238c84971d4cb5f06ef7398bfecc4f2b786200fee67d7307f242da565",
"8b707d4f8f32c80709d880fb257873915033c7d5bce9589a80ca9437618262c55dbe8eec2e8c82469bc335a84a8f16f89afcc53b8329dced5407a513927efc4c",
"8e98d00c5d110856943461cd85305b0a817abb457c2afc8e89edb32e502d0060081c8e667d9fceb63a2f8efbcb6e193e9b0231afcc05ecb2303d7f742f304396",
"90bb7c91281bb6625a0700c1ee2f3cee488cb9c1864ccf2e24699c5d957b1b7b686574d11acb37572fdf18a15f272fd44009b6cfce9b6cdf9025dd5002869d30",
"911c26cf828319df5123a9cf38641704961a6b894aa6ee2b0d13409996a93d89f4868b91e0eb1efea907a70a14cf3a3bd8935033aeb03bd8555f2dea857a48bd",
"92862e616dce7469bafc507ab8fbb47bb6f5ca8b96b05e9fbf39a259d1d4c4cac97b0472f713db2e5fbff0d3e587e7b34bedff80cc2a70c446becf9b488370d9",
"92a15e2cbd0c89fbce36b05e3b282255097bb5492fc11f0d2b0a08c4311621a41ec35df201de51523b62189a3b44bb3eb1cbdf64e80f4a543d0d9f9a99f9bd3f",
"97679def7032179662646816abc12f74fc693fb02c43675a2d5407e58be6dacd1eb483d1bf46f66c5103de3a649211c29e1127dca473e13b02dcd5e7df719cc0",
"97e29f9edfe712b059203de5af236569e2c41fae8cddfc7b486204d6e30c411ec605c757fa5a1a151646092bd5d71de18a5f2d8b6fb74b9a28a7c7226a4f641b",
"9b5f9ebc961424b8a6b7def59a86ad6fa6e45fc9ad5fb251c15d4d09202e6d3f63bb37b80faa4fdfe3997182079988d78556a9ebf7db535951a1e3cba0c0f6c9",
"9b847b5006ea1b47dc0ec366d09aec4a67aec747c55af554c094994fe8c8625b09cfd5322958c816bea74f725abb3d1403f2e9336007db3b257949401b1fef03",
"9cdf4ab91c8ef6148dfd724f2a2c644cc00df44f5eea5035e760ac59ec79078ffaf3d97a9c5a9747c04895a3dc666339f82cd17e40095b9fd055df3ff07da6d6",
"9fb127fbe4659174b52ef61778a705cc5a96c8f136445bd28c10ac79398ab9ea291852b627e285e828fe37aa23d05b13cf202f3f0cb4c272aba94dd1806802c9",
"9fe6ba948da2f4e4aa0e1b0d3e1aec1f093335f8097d7dd3d6b5217cd539f5c41735ef7a615d8210f2e6b777b7198f151264ade172be7dbbf5d442bf91843e8f",
"a1afb2eae49546bf59e6f9a1968287add54dd6e336ec795037090a435f736b6d8ba2076e05e27034979a8caaeafce05fc6d9d5541f4e5a4321e64106dabd1549",
"a2b06b54679145e65ce10a8356285efcadbacd41be817d2e0858ddba59e638775b79f76cb9e4ac5859627b67ebf227c55b51cc48e6d0d7ef41c9845d96ded68a",
"a2b503bc78bd0b68fcdc3e3b68e3c68cf3da8d2d48d91f09313c7cdc11b43dd4d4de3a8a2c4b526809adf9879427c4818db72cffdbc2f0015a9fa5ade83bd400",
"a359c15185b6d2a402dacfb7b3dc2e3ce5fd80a1add892b2dcf8e23bebe57f16680eebf7a851c3a870d3ba9932c4e42bad937c4676931d849c62f021ba812860",
"a35dea43a67cbd18b705cf2b28114652686eb409c1ae1e56c04256fd902ba9ab52c7343bb8b162522bf3442da42431246644432c70f819ba8617a723abcce836",
"a4b1eb406ff2c349437a5634148365fd0eecad5a264036e3af171d0f6769a7129590a0a3e09592038baa8bc1292af2bbdbfb74e3b1a685844e263532a87baef6",
"a4b8fa949865e0aa45147a27f0a034a26e34745d624dcf0603dd25fd1ce279eaf2d073a853d67e6432447d5e06708d71a9cddac0d2918876d2d3498af3ae0892",
"a6bc3c6beffd4335228c3b4857365215f0c4bc5197a5b0eca95334af33dba19ebf8d513f6c75359d7cb678b051d96579d73ebdaa5b6906e3b6eab35005bee13e",
"aabfdbdc21150ac70f9bb1a34f4d7de570a72ba7e1afd8c08d64c85e00c12e6ca1f2ffe60dbd16a871987bd7aa47182baf57e7f68daaf0bac7fc3b907c8ef4c0",
"af506d21ee140905c125e61c19d04599354fe84fe211502c9c766951387f6ff79e80db0658392af173f37ef7c92d7815ac9214e8ba4c6ade3e7a7ef014e5cc08",
"b04a1d5062f2921f39074e4f5c00675269195834a0a9c0bcce10b1427bf8a6499bdd7d8c6717f220aa4ec9f590bb04b290673018528a60dd819ce9798b0a33b4",
"b0a3c5148905a3e7e18c773684026e4ccd8811c3c62f6fcfc23135686a8db9c2caa6de7b14775e29b7cdeb360ae25ea626381c7689ade892c3fb72f82e2daa89",
"b1a0cbb91459433ff6de32b189783a734c2ada4c04d7dd164de449ce79c749d382aff10aa9ed7b4449af3390da51585123ef88719ecf7cfea9c24223023a23dd",
"b47a96b489f4dd851c364dee278699905f1ed933ba3a98a6660160463a8decef830bb91ac0a1b4f9b742df2dfbdc9625ec27133a69f6cf3cb81ed298183764e7",
"b52e493e5049e86223385546f3407f5924fd75311a0a11af38423b7bb7c02c3f085fd1d9188515c7b43c59fbf168c23126456dba98dc9c0d29b7a3edee159015",
"b5419f6ea89dc32431a7671df1ebf934647bba5b27db54235fb1e47d691b70c3160bf8019653d5faad616b169adfea5d8e7077e9820d9294144354133d45ee16",
"b570d19edbda421e0975056b5fdf4cefbc3825b840aacaa337567ec1aa151a81633eb645a86c8c1c22b23e7f916c60c20cb115de29b670511fb9413611e8cc3b",
"baff09432cffceac6ecd395a8ed5c947fdafe6c30c1c0f3b83c4ddfaa2ca9d57b21876153ac2b82067d7d37bc6789e2f68558f1f26fbcd53fd6a500124f80655",
"bc0b544f1c13cc1d0fe15b0eab96e89e6d4dfc8919de1fb757ef97a7d5de9efff5e520def5a8471b75480fd49d410d222ed9332089bd527946c74070e8ad1934",
"bc3886ba087d3fd637a4fa85adf33170e23b369c0c6eca422ddb26c73c04ae467e2b95ed73bead19013001af65bf2cf0d686a6e702b458a77068184c8b17dfb5",
"bd609b6955a6a35a5580a6e19e173b02fa6d4ed880b6cba8fb5d2fd91309dc753326a824a47ee6148b3d6a01b9b49ce7c1122b1e30b6ea181bd257bbc38c2940",
"bet",
"bf64f21ff129fae4bf3ff795c39df0a4a6dc40ece1d71747a913dd84af2e4cac4e1b84213e23cb1397b3299f26b1b6302a3cdbd41da8baea2505febd6e1803ce",
"bfe8d96ce71f9cce7bd16b5282041c66773405f1a11f4f0c8d3b6e81646f262bdac0cb3ee8f54e13175ba9ed7da38407e8a9aeff20972271f0c62c0b19f8b644",
"c088e98f02d33581ac0d79c37a101e4273e0750a5691cffd96a09c38742617dae948cbc4affbff4ece1d611e44ea5539f0597eef33ef39f7f0e3ec2a5edf75eb",
"c1bafe50eb70a1b65188fac549c6bbe7f641b672fbe9fd08cb64ed1f176efbedeca88f5c295d508e2dbf9b495fe0040bbbfbc4776af0d6cad6576a997db3e4cc",
"c1e166044d7731207ce8b838011eae84814857a8ddb63b8a393d2497bdcd7e96d045aa229a7978533646cf9f9ea99a619943599d47a1558073690601fb486ad5",
"c21ee36416076c1929dd93af7e936e371d4fe263662a2deb8fd6b0e5cd5b8cd86437b4afb2faa8813bd7b8689c7f56a63729a1e666684d8303f469faad669e54",
"c3f1018eb1f7b5e5c0210deab309d06d3e8e9e15ec7dd41d2dbcf863c39e36955b2034fe44af5a4983285b8fc6c0d92b092f95383f8989c1d75a40a4bcdd3d83",
"c4d740361d5f6bdcf408abc029d8adceb35f06c332c46fc290d187d96562992a8d6caa562eaa21643c346d44c9e706cd991ba986e53cfe37b41a0e048d14d6e0",
"c5d4c712e06053bc35bc6cef173daaaae7fd47db5ac812b95a2f0f08374432ffeaa2b49a0f10cb60f38405d2459489df0e43fb73b48bdb6caadcb4405915c33e",
"c777d3358a0aff067b64f254ac462fa223a1650af20ce2af341de610eebbb55a128a1dc43c91da7a1844848b5920b7dd5c5e0a1e8651d6442a2418709dad8c87",
"c96c4e97012d25add2fe69513a5b1f941fc36c837737780c443203c72182b808a129982ebd64aaffb8eda4ba3c8787fd98ca55fd33f060f63917567446417574",
"c9774fae6c0a30b456a21005abf026799f370a12fbcbc098e81bac2456955320ec6e712f1d6f9d59a50d615f81c6284785292180364598987a7990ae83c0f0c9",
"cb557116fa7b3b6da35024b539795d9e255c111c06edbf0e77ba728dd352353182c96918c649fb9327bbb4fea1bb25affcade9b5069676b191611062941356e7",
"cc3b30ba0f733abfe64667838f620c4f542db4665fa68e4d945b75ac0d2c435e6529e6541c4ac8ca18dec753b10e3a5c4614cfbc658dc951ab6cab357e6ef363",
"ccd85fb40538f948396a4c2bf381ea591927a7cde9330ecab883cad5bd59db56f0c983362f9d0a8e88a67d3f2bae2182bc8ea94b4e3adc721c782ca5c801e2af",
"cd1226e73c8275de15f2edb3744a413277fc76a4ebb7842fb743215c14b405b96c4e64bc8324feafe58937da218a1b0aeb9451d5781672ced1ad68c31eb54ba1",
"cdc5df38351edbdf7afdb3aaf0b4f53253cedbf3f43d662548a432f86389505fd6f2f64f51f951355f4fcfc5718a98dd782e1472246556c87f0bbaacebb38cb8",
"ce31dc5dfa61834e3ab67925ff5f24baf04b4aee6e35cd8ffa524f87b2e2e094999f85c68cc7a1c0e9b19016d050c1755406d02f7116ef85afa355c65a9a5855",
"cefa12e7ac99a5d11df487ab6521837b11165246d1c3cdb2108770532cb1429c2dcba5262a4dbd9a37686bb76ad1c48ddecf473d807c2e552534b24bb78ee30d",
"cf5b890eb74b4ac647d011a989a92a413c23c0db580c87057fc5afba2d83dd861f2a8640fb952381d090328d6278dbe56713d516020ce95cfb6d4fecf63b89e7",
"cf8c583b1282449a97b72e317e56d5a4d1432e5420148a21ba8fd8bb2a172c7832379f30cd6582bd6674b548deb8517c8915c5c4b423bd3e73903f71b8862380",
"d0cd44fcdae652efb0dd428cd1b8f1911e6eb2ca3469a1f2d6f9faf97a9d05e30f28387dfb81bfb4c97eba64187a0c047c85bf06998ccaec58781f3982626bb6",
"d15bfc3278de168872744ebec8fc7a07678bd04b7557e89749eeedc7087fe0a36cb8b094e978e979d67feba46c4a2741f0fab18010796b5ff436836a5fc67e88",
"d3d64ab67746fcb7b4a37d6b6b80c9d4b11afd9e15d81a60b3fde53e4f99267a63b50cfb2184c7c84c9f0dd4345c0d929160a7df52698a82603c112e0bf8ab8e",
"d647b73602a3a0c1b06f282a612c29eefc6a7e372bc8af212a41f481843c23a975b41ca402f06ecb7dc660d4dd22a814f7659b48da7dfd28c02a319032394da1",
"d98d182c89b465adb0fdd1cc5c2bcb22b81fcc4eb941977b667de22927ccc9a7876033008118957d803c83afb95595986bcc076e77483dd55dca91ce253ba010",
"dafd89491990553f5e22021f96344b3bc92be6a419c919ba78860876f226e51e668dbabcb11cf9500f3bd05582b387907ea007b5e8f37c78fb71ac819b9bc20e",
"db6932752693a1b2e7ef9af4adbf6fc8a299f21965ff9ff52b141563a471600df9308a89562af7b664b7fe14da134b4f44beafcf910f8794652e16dc475796b5",
"db8eecd1ac9b20918e31f04331e46007f367c1f6365c9c4abb7af70eb1d2ea12174375fb95d1d11c46e03c81976de6d68f70693e1ea7f2096aecf06307a17d29",
"dbe9efadf636bdd82f3ac2b3710653421e7cefca01b74012824b73f7368469fc4dd7e788b047920d4b3b7e4a486c732872ca11a75a89d1323337191ac2bc899e",
"dca1aa77f919ef1000d91291ba68800340332c299e3c4c6bcabb41fd2305f36db353211d6ac691c37d16889e3c3ffc1efb7c621e8040cb77b7249e264af44768",
"dee065b956b99b10db4763759d64c41791af1a7e77f1864f90a2b0847a12633dcf9bc108db7eaf73cc8d0e750f5c37383a56cd77cc2276d3960104c6bebe6346",
"df52eb2c24a6c35b977a1d0fab336ab5c21cd84f78f685d5f0bea9ebaa7c078c0ca69717455e29f17bcd9282a1af9cbbe2d3e608c62cecf868419da081e2d810",
"dfc8721858bd56b846473eb6123420a2735fc69cd77a92a1d2c623c51eab3ac664d61a890d305c6fe77ec48f2759248744e9d56689f6c22317bbaa316c848fbc",
"e249989b0c397ac03583594a3911c9e9222ccce620921170bb39b8ab6fdaf136b164f3c9fcd8b4f750fc469c9cd69f144c2ca2dd918fcb778148fbf9751a869b",
"e364856fe22a5c80cc8d13ee445473a0eb7204bad6972fc4c116ea1551b50da43a01577ef0487f2afb7aaee4b4155d61b1ff2b83dc502363929de76af0226818",
"e37d85b60af58cc03e9b36e09dee5e8308368f44f91b28455e7f645a13fe29902e7f7d594ccb600e02caf4202a05d15477d4ea5191c7b97038ea06d73ce93c33",
"e41b679ec1446821bf0a80fa7003fb90ac66b79d09c00dccf702a1b254f9ea85a68b0643ecd81d999413d5814b06b9998afd9876062067f51a63747533921d08",
"e61565e75d632748413d51997cabb00613355f0a94cf6b2f929fdfa351490d2afc9bad72c7fa67595d9d9c7adc9454e8d1b05527991a17258424b14ec4e9a1d5",
"e6a64aa839b95caeb74d810677a33b747e23907213719dd9706af7364b4cacf204b09f9b26686a70cd6d416a6b590f87103cc683685529968ea0edd75107f649",
"e751d2f83310990aedc7392b54f827afac1873e9f8861e625814a8d1d15776160864742d557796d07a612479b2886287b417273cc9f7718889216c2ec3b3b7ed",
"e7847a5814b865bc043600fee7d810b9815da389278fdfdd412114ab8f87b1536f4b63f3f7c3d3eeb097486abc152043eefdae6fd12c2f8743dac1cb668ab136",
"e82ba384934ac4780595261c43eeceb3df29a047087870f5da13c7acae782b4b97857b98852ce235428b4bc24aa4ddcdcd7297acf683421201eff1c3fbcab84e",
"e9da05b6d590dcf94addabd168c543be41a2275ddf44f6f44db1e3698f0bf7dd67f2e93b66679e0a0d42a2f39f3bc6a389f0e6b362431d0cb197fe46f9dd6606",
"ea8456e0667e1cce6273cb333b7e6982f9aa0f260c7c103e04eb0076a73fe3497070b1a8f0c45b097dc3100a30254095a1c63e9514367655e9a378344ed25d1d",
"eb415e110eaff48bdbc03b5ab719f64593f222b4a1d872b552e4fc48d338e532d1954f76e94813e44a6cd030425b4076cd7b9bf388b870a31344545d092dfa1a",
"eb5078bcb64f9595d6d8589ad60502b2870f16942fbb4cbd2483c817c7fa460faeda90b82bcf531ac96be8c1d6825953ab85ab0bd46ea477615e71e50386ffe0",
"ed5c9e654bfb28e9d4131b3805597ee9fa14fe72c6e2a6d503ec2e47faf396bbfa15ce49e6fe83bd97da1d441138545d388a329ae888c1f1ea44fc62996d787f",
"edba91511ccf8ab01de2e2cef34c47d8430f8a2f4c62cd66c42ecb62da52d396e909aef7da067eedc58e1eb58a1fc3697939371e6a36c931af5987a50509854b",
"ee216d2d13cba1a951445b061771ab0c97eb3c250003e16008debd85fa0317a508f923db79c796dc29de18c83baad5b15651f80db1cf7aee854e6da28853b742",
"eli",
"eva",
"f1812dbb566edaa2ac92121641e5ae504d647bec835a02ed5d7c7f90424d0e8fe202846a599c2f74c49ec9b86181d3d6c50ac0688baa9b4c28608d592becdfdb",
"f26a63e5171e2935e13015fbb755f04bff87fb1767ac91aa3481b9fe13b54cc75f772b41dfdc634829dd9b44c7b08798ed114046ef981d454889c41d4f6408d9",
"f2f359ea473c07070fd1e50d2fcfe3dc4f624f01678c35920b079660b2d5b9c1743259ae6129992cd3b99ec2cdda94a45e8710888488b196c6cd9c853e86e454",
"f35ce011f75fc01d153a94339aad24ae4fd5f181af55916a5ca0153cd5220ed199b98459eb88e9f4f3a4f8fbcf5c272bafdca35ddaca0827c4b480f79e7db1d6",
"f4df4a067fec667827901fb55acb16acc4650f24eeaa588af1a103e5009e9166f753c7cd313d0d3dec79abb82a13c43fd2059db5ac0307b78369ca318001c4e7",
"f56a47b89ebd2d22f869e2260b55f70d7ae0d499fc3fd4dbcb0e6e507f12513f29c004b9426e428696df0d434e4ad467f143bc620a2f661a54608de9e2c265d5",
"f61bdd3abb2d03f07e33bfb0b9fba46069468cefd9eda04e77cdc5c2f13a417716d3e60ca91c39de1a480b72112ef0e6143e927fad45410ee252cfce9034f0b1",
"f62196a11f50362b35eb1ed830b03c18bb187e4d07014a3d1b238756fe836f254afa923184170512a0c6d990032b4b1edb25dd2b74f6fc15f6ef6b51b6f82dd4",
"f8e4bf2dd4f93dd473b055ebf2dfa6081703014fddca40a0efb6bd5dcb702244a30a2d3edcd6597ea4118c20258da575a0bc69a895356519d8400a5ad3b2bf58",
"f980d152d5c14c6e7557f13fe26305ed0105dbb23177d455372e5529a5d3333e203070e87352d985a136f5ce3976a16b97070a4343fb4cb9d0760d9bcd5c7677",
"fa8641fb64db60e7299f070f6497678dee0bfdeefcc22a51ca328da34b33fdd6c31b882d97fc32cfcdeee4fcb72b05d7eae43b10b531db161b7e8dcfc2775ebf",
"fdde8cdd2fa5689aec75121e3c0778ca8c37238fd6a64706d85a4156d7735c482f1db74cefd023e94587b64a56d4a06e3b7fecf5c85978a4c777c9eaa5c633fd",
"jan",
"mar",
"ona",
"pau",
"pep",
"pol",
"teo"
]
}
}
},
"fa": {
"custom": {
"glow-tts": {
"id": "tts_models/fa/custom/glow-tts"
}
}
},
"bn": {
"custom": {
"vits-male": {
"id": "tts_models/bn/custom/vits-male"
},
"vits-female": {
"id": "tts_models/bn/custom/vits-female"
}
}
}
}

5972
public/scripts/handlebars.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -644,7 +644,6 @@ $(document).ready(function () {
const formattedValue = slider.format(value); const formattedValue = slider.format(value);
slider.setValue(value); slider.setValue(value);
$(slider.counterId).text(formattedValue); $(slider.counterId).text(formattedValue);
console.log('saving');
saveSettingsDebounced(); saveSettingsDebounced();
}); });
}); });

View File

@ -46,6 +46,12 @@ export {
export const MAX_CONTEXT_DEFAULT = 4096; export const MAX_CONTEXT_DEFAULT = 4096;
const MAX_CONTEXT_UNLOCKED = 65536; const MAX_CONTEXT_UNLOCKED = 65536;
const defaultStoryString = `{{#if description}}{{{description}}}{{/if}}
{{#if personality}}{{{personality}}}{{/if}}
{{#if scenario}}Scenario: {{{scenario}}}{{/if}}`;
const defaultExampleSeparator = '***';
const defaultChatStart = '***';
const avatar_styles = { const avatar_styles = {
ROUND: 0, ROUND: 0,
RECTANGULAR: 1, RECTANGULAR: 1,
@ -93,11 +99,6 @@ let power_user = {
collapse_newlines: false, collapse_newlines: false,
pygmalion_formatting: pygmalion_options.AUTO, pygmalion_formatting: pygmalion_options.AUTO,
pin_examples: false, pin_examples: false,
disable_description_formatting: false,
disable_scenario_formatting: false,
disable_personality_formatting: false,
disable_examples_formatting: false,
disable_start_formatting: false,
trim_sentences: false, trim_sentences: false,
include_newline: false, include_newline: false,
always_force_name2: false, always_force_name2: false,
@ -106,7 +107,6 @@ let power_user = {
multigen: false, multigen: false,
multigen_first_chunk: 50, multigen_first_chunk: 50,
multigen_next_chunks: 30, multigen_next_chunks: 30,
custom_chat_separator: '',
markdown_escape_strings: '', markdown_escape_strings: '',
fast_ui_mode: true, fast_ui_mode: true,
@ -176,12 +176,20 @@ let power_user = {
stop_sequence: '', stop_sequence: '',
input_sequence: '### Instruction:', input_sequence: '### Instruction:',
output_sequence: '### Response:', output_sequence: '### Response:',
last_output_sequence: '',
preset: 'Alpaca', preset: 'Alpaca',
separator_sequence: '', separator_sequence: '',
macro: false, macro: false,
names_force_groups: true, names_force_groups: true,
}, },
context: {
preset: 'Default',
story_string: defaultStoryString,
chat_start: defaultChatStart,
example_separator: defaultExampleSeparator,
},
personas: {}, personas: {},
default_persona: null, default_persona: null,
persona_descriptions: {}, persona_descriptions: {},
@ -200,6 +208,7 @@ let power_user = {
let themes = []; let themes = [];
let movingUIPresets = []; let movingUIPresets = [];
let instruct_presets = []; let instruct_presets = [];
let context_presets = [];
const storage_keys = { const storage_keys = {
ui_language: "language", ui_language: "language",
@ -662,6 +671,10 @@ function loadPowerUserSettings(settings, data) {
instruct_presets = data.instruct; instruct_presets = data.instruct;
} }
if (data.context !== undefined) {
context_presets = data.context;
}
// These are still local storage // These are still local storage
const fastUi = localStorage.getItem(storage_keys.fast_ui_mode); const fastUi = localStorage.getItem(storage_keys.fast_ui_mode);
const movingUI = localStorage.getItem(storage_keys.movingUI); const movingUI = localStorage.getItem(storage_keys.movingUI);
@ -720,16 +733,10 @@ function loadPowerUserSettings(settings, data) {
$("#spoiler_free_mode").prop("checked", power_user.spoiler_free_mode); $("#spoiler_free_mode").prop("checked", power_user.spoiler_free_mode);
$("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines); $("#collapse-newlines-checkbox").prop("checked", power_user.collapse_newlines);
$("#pin-examples-checkbox").prop("checked", power_user.pin_examples); $("#pin-examples-checkbox").prop("checked", power_user.pin_examples);
$("#disable-description-formatting-checkbox").prop("checked", power_user.disable_description_formatting);
$("#disable-scenario-formatting-checkbox").prop("checked", power_user.disable_scenario_formatting);
$("#disable-personality-formatting-checkbox").prop("checked", power_user.disable_personality_formatting);
$("#always-force-name2-checkbox").prop("checked", power_user.always_force_name2); $("#always-force-name2-checkbox").prop("checked", power_user.always_force_name2);
$("#disable-examples-formatting-checkbox").prop("checked", power_user.disable_examples_formatting);
$('#disable-start-formatting-checkbox').prop("checked", power_user.disable_start_formatting);
$("#trim_sentences_checkbox").prop("checked", power_user.trim_sentences); $("#trim_sentences_checkbox").prop("checked", power_user.trim_sentences);
$("#include_newline_checkbox").prop("checked", power_user.include_newline); $("#include_newline_checkbox").prop("checked", power_user.include_newline);
$('#render_formulas').prop("checked", power_user.render_formulas); $('#render_formulas').prop("checked", power_user.render_formulas);
$("#custom_chat_separator").val(power_user.custom_chat_separator);
$("#markdown_escape_strings").val(power_user.markdown_escape_strings); $("#markdown_escape_strings").val(power_user.markdown_escape_strings);
$("#fast_ui_mode").prop("checked", power_user.fast_ui_mode); $("#fast_ui_mode").prop("checked", power_user.fast_ui_mode);
$("#waifuMode").prop("checked", power_user.waifuMode); $("#waifuMode").prop("checked", power_user.waifuMode);
@ -799,6 +806,7 @@ function loadPowerUserSettings(settings, data) {
sortCharactersList(); sortCharactersList();
reloadMarkdownProcessor(power_user.render_formulas); reloadMarkdownProcessor(power_user.render_formulas);
loadInstructMode(); loadInstructMode();
loadContextSettings();
loadMaxContextUnlocked(); loadMaxContextUnlocked();
switchWaifuMode(); switchWaifuMode();
switchSpoilerMode(); switchSpoilerMode();
@ -867,6 +875,61 @@ function switchMaxContextSize() {
} }
} }
function loadContextSettings() {
const controls = [
{ id: "context_story_string", property: "story_string", isCheckbox: false },
{ id: "context_example_separator", property: "example_separator", isCheckbox: false },
{ id: "context_chat_start", property: "chat_start", isCheckbox: false },
];
controls.forEach(control => {
const $element = $(`#${control.id}`);
if (control.isCheckbox) {
$element.prop('checked', power_user.context[control.property]);
} else {
$element.val(power_user.context[control.property]);
}
$element.on('input', function () {
power_user.context[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val();
saveSettingsDebounced();
});
});
context_presets.forEach((preset) => {
const name = preset.name;
const option = document.createElement('option');
option.value = name;
option.innerText = name;
option.selected = name === power_user.context.preset;
$('#context_presets').append(option);
});
$('#context_presets').on('change', function () {
const name = $(this).find(':selected').val();
const preset = context_presets.find(x => x.name === name);
if (!preset) {
return;
}
power_user.context.preset = name;
controls.forEach(control => {
if (preset[control.property] !== undefined) {
power_user.context[control.property] = preset[control.property];
const $element = $(`#${control.id}`);
if (control.isCheckbox) {
$element.prop('checked', power_user.context[control.property]).trigger('input');
} else {
$element.val(power_user.context[control.property]).trigger('input');
}
}
});
});
}
function loadInstructMode() { function loadInstructMode() {
const controls = [ const controls = [
{ id: "instruct_enabled", property: "enabled", isCheckbox: true }, { id: "instruct_enabled", property: "enabled", isCheckbox: true },
@ -880,6 +943,7 @@ function loadInstructMode() {
{ id: "instruct_names", property: "names", isCheckbox: true }, { id: "instruct_names", property: "names", isCheckbox: true },
{ id: "instruct_macro", property: "macro", isCheckbox: true }, { id: "instruct_macro", property: "macro", isCheckbox: true },
{ id: "instruct_names_force_groups", property: "names_force_groups", isCheckbox: true }, { id: "instruct_names_force_groups", property: "names_force_groups", isCheckbox: true },
{ id: "instruct_last_output_sequence", property: "last_output_sequence", isCheckbox: false },
]; ];
if (power_user.instruct.names_force_groups === undefined) { if (power_user.instruct.names_force_groups === undefined) {
@ -976,6 +1040,20 @@ export function fuzzySearchGroups(searchValue) {
return ids; return ids;
} }
export function renderStoryString(params) {
try {
const compiledTemplate = Handlebars.compile(power_user.context.story_string);
let output = compiledTemplate(params);
output = substituteParams(output, params.user, params.char);
output = `${output.trim()}\n`; // add a newline to the end
return output;
} catch (e) {
toastr.error('Check the story string template for validity', 'Error rendering story string');
console.error('Error rendering story string', e);
throw e;
}
}
export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar, name1, name2) { export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvatar, name1, name2) {
let includeNames = isNarrator ? false : power_user.instruct.names; let includeNames = isNarrator ? false : power_user.instruct.names;
@ -1011,7 +1089,8 @@ export function formatInstructStoryString(story, systemPrompt) {
export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) { export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) {
const includeNames = power_user.instruct.names || (!!selected_group && power_user.instruct.names_force_groups); const includeNames = power_user.instruct.names || (!!selected_group && power_user.instruct.names_force_groups);
let sequence = isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence; const getOutputSequence = () => power_user.instruct.last_output_sequence || power_user.instruct.output_sequence;
let sequence = isImpersonate ? power_user.instruct.input_sequence : getOutputSequence();
if (power_user.instruct.macro) { if (power_user.instruct.macro) {
sequence = substituteParams(sequence, name1, name2); sequence = substituteParams(sequence, name1, name2);
@ -1639,31 +1718,6 @@ $(document).ready(() => {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$("#disable-description-formatting-checkbox").change(function () {
power_user.disable_description_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
})
$("#disable-scenario-formatting-checkbox").change(function () {
power_user.disable_scenario_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
});
$("#disable-personality-formatting-checkbox").change(function () {
power_user.disable_personality_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
});
$("#disable-examples-formatting-checkbox").change(function () {
power_user.disable_examples_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
})
$("#disable-start-formatting-checkbox").change(function () {
power_user.disable_start_formatting = !!$(this).prop('checked');
saveSettingsDebounced();
});
// include newline is the child of trim sentences // include newline is the child of trim sentences
// if include newline is checked, trim sentences must be checked // if include newline is checked, trim sentences must be checked
// if trim sentences is unchecked, include newline must be unchecked // if trim sentences is unchecked, include newline must be unchecked
@ -1690,12 +1744,6 @@ $(document).ready(() => {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$("#custom_chat_separator").on('input', function () {
power_user.custom_chat_separator = $(this).val();
saveSettingsDebounced();
reloadMarkdownProcessor(power_user.render_formulas);
});
$("#markdown_escape_strings").on('input', function () { $("#markdown_escape_strings").on('input', function () {
power_user.markdown_escape_strings = $(this).val(); power_user.markdown_escape_strings = $(this).val();
saveSettingsDebounced(); saveSettingsDebounced();

View File

@ -8,8 +8,12 @@ export const markdownExclusionExt = () => {
} }
let combinedExcludeString = ''; let combinedExcludeString = '';
if (power_user.custom_chat_separator) { if (power_user.context.chat_start) {
combinedExcludeString += `${power_user.custom_chat_separator},`; combinedExcludeString += `${power_user.context.chat_start},`;
}
if (power_user.context.example_separator) {
combinedExcludeString += `${power_user.context.example_separator},`;
} }
if (power_user.markdown_escape_strings) { if (power_user.markdown_escape_strings) {

View File

@ -552,6 +552,7 @@ app.post("/generate", jsonParser, async function (request, response_generate = r
} }
const data = await response.json(); const data = await response.json();
console.log("Endpoint response:", data);
return response_generate.send(data); return response_generate.send(data);
} }
} catch (error) { } catch (error) {
@ -601,18 +602,14 @@ app.post("/generate_textgenerationwebui", jsonParser, async function (request, r
const websocket = new WebSocket(streamingUrl); const websocket = new WebSocket(streamingUrl);
websocket.on('open', async function () { websocket.on('open', async function () {
console.log('websocket open'); console.log('WebSocket opened');
websocket.send(JSON.stringify(request.body)); const combined_args = Object.assign(request.body.use_mancer ? get_mancer_headers() : {}, request.body);
}); websocket.send(JSON.stringify(combined_args));
websocket.on('error', (err) => {
console.error(err);
websocket.close();
}); });
websocket.on('close', (code, buffer) => { websocket.on('close', (code, buffer) => {
const reason = new TextDecoder().decode(buffer) const reason = new TextDecoder().decode(buffer)
console.log(reason); console.log("WebSocket closed (reason: %o)", reason);
}); });
while (true) { while (true) {
@ -621,8 +618,27 @@ app.post("/generate_textgenerationwebui", jsonParser, async function (request, r
websocket.close(); websocket.close();
return; return;
} }
let rawMessage = null;
try {
// This lunacy is because the websocket can fail to connect AFTER we're awaiting 'message'... so 'message' never triggers.
// So instead we need to look for 'error' at the same time to reject the promise. And then remove the listener if we resolve.
// This is awful.
// Welcome to the shenanigan shack.
rawMessage = await new Promise(function (resolve, reject) {
websocket.once('error', reject);
websocket.once('message', (data, isBinary) => {
websocket.removeListener('error', reject);
resolve(data, isBinary);
});
});
} catch(err) {
console.error("Socket error:", err);
websocket.close();
yield "[SillyTavern] Streaming failed:\n" + err;
return;
}
const rawMessage = await new Promise(resolve => websocket.once('message', resolve));
const message = json5.parse(rawMessage); const message = json5.parse(rawMessage);
switch (message.event) { switch (message.event) {
@ -673,11 +689,11 @@ app.post("/generate_textgenerationwebui", jsonParser, async function (request, r
try { try {
const data = await postAsync(api_server + "/v1/generate", args); const data = await postAsync(api_server + "/v1/generate", args);
console.log(data); console.log("Endpoint response:", data);
return response_generate.send(data); return response_generate.send(data);
} catch (error) { } catch (error) {
retval = { error: true, status: error.status, response: error.statusText }; retval = { error: true, status: error.status, response: error.statusText };
console.log(error); console.log("Endpoint error:", error);
try { try {
retval.response = await error.json(); retval.response = await error.json();
retval.response = retval.response.result; retval.response = retval.response.result;