Merge branch 'staging' into swipe-nums-for-all-mes

d3120afc6039814e989a4e4a93cf78bf7b651f04

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +18 -15Ignore whitespace
public/index.html+10 -13
@@ -1709,9 +1709,9 @@
17091709 <div class="">
17101710 <div class="inline-drawer wide100p flexFlowColumn">
17111711 <div class="inline-drawer-toggle inline-drawer-header">
17121712 <div class="flex-container alignItemsCenter flexNoGap">
17131713 <b data-i18n="Character Names Behavior">Character Names Behavior</b>
17141714 <span title="Helps the model to associate messages with characters." data-i18n="[title]Helps the model to associate messages with characters." class="note-link-spanopacity50p fa-solid fa-circle-questioninfo"></span>
17151715 <small class="flexBasis100p">(<span id="character_names_display"></span>)</small>
17161716 </div>
17171717 <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
@@ -1720,25 +1720,22 @@
17201720 <label class="checkbox_label flexWrap alignItemsCenter" for="character_names_none">
17211721 <input type="radio" id="character_names_none" name="character_names" value="-1">
17221722 <span data-i18n="None">None</span>
1723- <i class="right_menu_button fa-solid fa-circle-exclamation" title="Never add character name prefixes. May behave poorly in groups, choose with caution." data-i18n="[title]character_names_none"></i>
1723+ <small class="flexBasis100p" data-i18n="character_names_none">
1724- <small class="flexBasis100p" data-i18n="Never add character names.">
1724+ Never add character name prefixes. May behave poorly in groups, choose with caution.
1725- Never add character names.
17261725 </small>
17271726 </label>
17281727 <label class="checkbox_label flexWrap alignItemsCenter" for="character_names_default">
17291728 <input type="radio" id="character_names_default" name="character_names" value="0">
17301729 <span data-i18n="Default">Default</span>
1731- <i class="right_menu_button fa-solid fa-circle-exclamation" title="Add prefixes for groups and past personas. Otherwise, make sure you provide names in the prompt." data-i18n="[title]character_names_default"></i>
1730+ <small class="flexBasis100p" data-i18n="character_names_default">
1732- <small class="flexBasis100p" data-i18n="Don't add character names unless necessary.">
1731+ Add prefixes for groups and past personas. Otherwise, make sure you provide names in the prompt.
1733- Don't add character names unless necessary.
17341732 </small>
17351733 </label>
17361734 <label class="checkbox_label flexWrap alignItemsCenter" for="character_names_completion">
17371735 <input type="radio" id="character_names_completion" name="character_names" value="1">
17381736 <span data-i18n="Completion Object">Completion Object</span>
1739- <i class="right_menu_button fa-solid fa-circle-exclamation" title="Restrictions apply: only Latin alphanumerics and underscores. Doesn't work for all sources, notably: Claude, MistralAI, Google." data-i18n="[title]character_names_completion"></i>
1737+ <small class="flexBasis100p" data-i18n="character_names_completion">
1740- <small class="flexBasis100p" data-i18n="Add character names to completion objects.">
1738+ Add character names to completion objects. Restrictions apply: only Latin alphanumerics and underscores.
1741- Add character names to completion objects.
17421739 </small>
17431740 </label>
17441741 <label class="checkbox_label flexWrap alignItemsCenter" for="character_names_content">
@@ -1754,9 +1751,9 @@
17541751 </div>
17551752 <div class="inline-drawer wide100p flexFlowColumn marginBot10">
17561753 <div class="inline-drawer-toggle inline-drawer-header">
17571754 <div class="flex-container alignItemsCenter flexNoGap">
17581755 <b data-i18n="Continue Postfix">Continue Postfix</b>
17591756 <span data-i18n="[title]The next chunk of the continued message will be appended using this as a separator." title="The next chunk of the continued message will be appended using this as a separator." class="note-link-spanopacity50p fa-solid fa-circle-questioninfo"></span>
17601757 <small class="flexBasis100p">(<span id="continue_postfix_display"></span>)</small>
17611758 </div>
17621759 <div class="fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
public/scripts/openai.js+8 -2
@@ -724,6 +724,12 @@ async function populateChatHistory(messages, prompts, chatCompletion, type = nul
724724
725725 if (chatCompletion.canAfford(chatMessage)) {
726726 if (type === 'continue' && oai_settings.continue_prefill && chatPrompt === firstNonInjected) {
727+ // in case we are using continue_prefill and the latest message is an assistant message, we want to prepend the users assistant prefill on the message
728+ if (chatPrompt.role === 'assistant') {
729+ const collection = new MessageCollection('continuePrefill', new Message(chatMessage.role, substituteParams(oai_settings.assistant_prefill + '\n\n') + chatMessage.content, chatMessage.identifier));
730+ chatCompletion.add(collection, -1);
731+ continue;
732+ }
727733 const collection = new MessageCollection('continuePrefill', chatMessage);
728734 chatCompletion.add(collection, -1);
729735 continue;
@@ -1770,8 +1776,8 @@ async function sendOpenAIRequest(type, messages, signal) {
17701776 generate_data['claude_use_sysprompt'] = oai_settings.claude_use_sysprompt;
17711777 generate_data['stop'] = getCustomStoppingStrings(); // Claude shouldn't have limits on stop strings.
17721778 generate_data['human_sysprompt_message'] = substituteParams(oai_settings.human_sysprompt_message);
17731779 // Don't add a prefill on quiet gens (summarization) and when using continue prefill.
17741780 if (!isQuiet && !(isContinue && oai_settings.continue_prefill)) {
17751781 generate_data['assistant_prefill'] = isImpersonate ? substituteParams(oai_settings.assistant_impersonation) : substituteParams(oai_settings.assistant_prefill);
17761782 }
17771783 }