Merge branch 'staging' into stability

6608e530c599632a61305a51788ec5d55cf16c9f

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

23 files changed, +81 -34Ignore whitespace
public/css/promptmanager.css+0 -1
@@ -233,7 +233,6 @@
233233}
234234
235235#completion_prompt_manager .completion_prompt_manager_footer a {
236- padding: 0.75em;
237236 font-size: 12px;
238237}
239238
public/css/rm-groups.css+1 -1
@@ -68,9 +68,9 @@
6868 margin-top: 0.25rem;
6969 margin-bottom: 0.5rem;
7070 border: 1px solid var(--SmartThemeBorderColor);
71- ;
7271 border-radius: 10px;
7372 background-color: var(--black30a);
73+ padding: 2px;
7474}
7575
7676#rm_group_buttons_expander {
public/index.html+7 -2
@@ -4141,6 +4141,10 @@
41414141 <input id="request_token_probabilities" type="checkbox" />
41424142 <small data-i18n="Request token probabilities">Request token probabilities</small>
41434143 </label>
4144+ <label data-newbie-hidden class="checkbox_label" for="show_group_chat_queue" title="In group chat, highlight the character(s) that are currently queued to generate responses and the order in which they will respond." data-i18n="[title]In group chat, highlight the character(s) that are currently queued to generate responses and the order in which they will respond.">
4145+ <input id="show_group_chat_queue" type="checkbox" />
4146+ <small data-i18n="Show group chat queue">Show group chat queue</small>
4147+ </label>
41444148 <div data-newbie-hidden class="inline-drawer wide100p flexFlowColumn">
41454149 <div class="inline-drawer-toggle inline-drawer-header userSettingsInnerExpandable" title="Automatically reject and re-generate AI message based on configurable criteria." data-i18n="[title]Automatically reject and re-generate AI message based on configurable criteria">
41464150 <b><span data-i18n="Auto-swipe">Auto-swipe</span></b>
@@ -5596,10 +5600,10 @@
55965600 <label for="completion_prompt_manager_popup_entry_form_injection_position">
55975601 <span data-i18n="prompt_manager_position">Position</span>
55985602 </label>
55995603 <div class="text_muted" data-i18n="Injection position. NextRelative (to other prompts (relativein prompt manager) or inIn-chat (absolute)@ Depth.">Injection position. NextRelative (to other prompts (relativein prompt manager) or inIn-chat (absolute)@ Depth.</div>
56005604 <select id="completion_prompt_manager_popup_entry_form_injection_position" class="text_pole" name="injection_position">
56015605 <option data-i18n="prompt_manager_relative" value="0">Relative</option>
56025606 <option data-i18n="prompt_manager_absoluteprompt_manager_in_chat" value="1">AbsoluteIn-chat</option>
56035607 </select>
56045608 </div>
56055609 <div id="completion_prompt_manager_depth_block" class="completion_prompt_manager_popup_entry_form_control flex1">
@@ -5796,6 +5800,7 @@
57965800 <div class="tags tags_inline"></div>
57975801 </div>
57985802 <input class="ch_fav" value="" hidden />
5803+ <div class="queue_position"></div>
57995804 <div class="group_member_icon">
58005805 <div title="Temporarily disable automatic replies from this character" data-action="disable" class="right_menu_button fa-solid fa-lg fa-comment-slash" data-i18n="[title]Temporarily disable automatic replies from this character"></div>
58015806 <div title="Enable automatic replies from this character" data-action="enable" class="right_menu_button fa-solid fa-lg fa-comment-slash" data-i18n="[title]Enable automatic replies from this character"></div>
public/locales/ar-sa.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "موضع",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "موضع الحقن. بجوار المطالبات الأخرى (نسبية) أو داخل الدردشة (مطلقة).",
10251025 "prompt_manager_relative": "نسبي",
1026- "prompt_manager_absolute": "مطلق",
10271026 "prompt_manager_depth": "عمق",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "عمق الحقن. 0 = بعد الرسالة الأخيرة، 1 = قبل الرسالة الأخيرة، الخ.",
10291028 "Prompt": "موضوع",
public/locales/de-de.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Position",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injektionsposition. Neben anderen Eingabeaufforderungen (relativ) oder im Chat (absolut).",
10251025 "prompt_manager_relative": "Relativ",
1026- "prompt_manager_absolute": "Absolut",
10271026 "prompt_manager_depth": "Tiefe",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Injektionstiefe. 0 = nach der letzten Nachricht, 1 = vor der letzten Nachricht usw.",
10291028 "Prompt": "Aufforderung",
public/locales/es-es.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Posición",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posición de inyección. Junto a otras indicaciones (relativa) o en el chat (absoluta).",
10251025 "prompt_manager_relative": "Relativo",
1026- "prompt_manager_absolute": "Absoluto",
10271026 "prompt_manager_depth": "Profundidad",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profundidad de inyección. 0 = después del último mensaje, 1 = antes del último mensaje, etc.",
10291028 "Prompt": "Indicar",
public/locales/fr-fr.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Position",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Position d'injection. À côté d’autres invites (relatives) ou dans le chat (absolues).",
10251025 "prompt_manager_relative": "Relatif",
1026- "prompt_manager_absolute": "Absolu",
10271026 "prompt_manager_depth": "Profondeur",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profondeur d'injection. 0 = après le dernier message, 1 = avant le dernier message, etc.",
10291028 "Prompt": "Inciter",
public/locales/is-is.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Staða",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Inndælingarstaða. Við hliðina á öðrum leiðbeiningum (afstætt) eða í spjalli (algert).",
10251025 "prompt_manager_relative": "Aðstandandi",
1026- "prompt_manager_absolute": "Algjört",
10271026 "prompt_manager_depth": "Dýpt",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Inndælingardýpt. 0 = eftir síðustu skilaboð, 1 = fyrir síðustu skilaboð o.s.frv.",
10291028 "Prompt": "Ábending",
public/locales/it-it.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Posizione",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posizione di iniezione. Accanto ad altri suggerimenti (relativo) o in chat (assoluto).",
10251025 "prompt_manager_relative": "Parente",
1026- "prompt_manager_absolute": "Assoluto",
10271026 "prompt_manager_depth": "Profondità",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profondità di iniezione. 0 = dopo l'ultimo messaggio, 1 = prima dell'ultimo messaggio, ecc.",
10291028 "Prompt": "Prompt",
public/locales/ja-jp.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "位置",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "挿入位置。他のプロンプトの隣 (相対) またはチャット内 (絶対)。",
10251025 "prompt_manager_relative": "相対的",
1026- "prompt_manager_absolute": "絶対",
10271026 "prompt_manager_depth": "深さ",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入の深さ。0 = 最後のメッセージの後、1 = 最後のメッセージの前など。",
10291028 "Prompt": "プロンプト",
public/locales/ko-kr.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "위치",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "주입 위치. 다른 프롬프트 옆(상대적) 또는 채팅 내(절대적).",
10251025 "prompt_manager_relative": "상대적인",
1026- "prompt_manager_absolute": "순수한",
10271026 "prompt_manager_depth": "깊이",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "주입 깊이. 0 = 마지막 메시지 뒤, 1 = 마지막 메시지 앞 등",
10291028 "Prompt": "프롬프트",
public/locales/nl-nl.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Positie",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injectiepositie. Naast andere prompts (relatief) of in-chat (absoluut).",
10251025 "prompt_manager_relative": "Familielid",
1026- "prompt_manager_absolute": "Absoluut",
10271026 "prompt_manager_depth": "Diepte",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Injectiediepte. 0 = na het laatste bericht, 1 = voor het laatste bericht, etc.",
10291028 "Prompt": "Prompt",
public/locales/pt-pt.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Posição",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posição de injeção. Ao lado de outras solicitações (relativas) ou no chat (absolutas).",
10251025 "prompt_manager_relative": "Relativo",
1026- "prompt_manager_absolute": "Absoluto",
10271026 "prompt_manager_depth": "Profundidade",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profundidade de injeção. 0 = após a última mensagem, 1 = antes da última mensagem, etc.",
10291028 "Prompt": "Prompt",
public/locales/ru-ru.json+0 -1
@@ -1025,7 +1025,6 @@
10251025 "prompt_manager_position": "Точка инжекта",
10261026 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Как рассчитывать позицию для инжекта. Она может располагаться по отношению к другим промптам (относительная) либо по отношению к чату (абсолютная).",
10271027 "prompt_manager_relative": "Относительная",
1028- "prompt_manager_absolute": "Абсолютная",
10291028 "prompt_manager_depth": "Глубина",
10301029 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глубина вставки. 0 = после последнего сообщения, 1 = перед последним сообщением, и т.д.",
10311030 "The prompt to be sent.": "Отправляемый ИИ промпт.",
public/locales/uk-ua.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Позиція",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Позиція ін'єкції. Поруч з іншими підказками (відносні) або в чаті (абсолютні).",
10251025 "prompt_manager_relative": "Відносна",
1026- "prompt_manager_absolute": "Абсолютний",
10271026 "prompt_manager_depth": "Глибина",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глибина ін'єкції. 0 = після останнього повідомлення, 1 = перед останнім повідомленням тощо.",
10291028 "Prompt": "Запит",
public/locales/vi-vn.json+0 -1
@@ -1023,7 +1023,6 @@
10231023 "prompt_manager_position": "Chức vụ",
10241024 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Vị trí tiêm. Bên cạnh các lời nhắc khác (tương đối) hoặc trong trò chuyện (tuyệt đối).",
10251025 "prompt_manager_relative": "Liên quan đến",
1026- "prompt_manager_absolute": "tuyệt đối",
10271026 "prompt_manager_depth": "Chiều sâu",
10281027 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Độ sâu phun. 0 = sau tin nhắn cuối cùng, 1 = trước tin nhắn cuối cùng, v.v.",
10291028 "Prompt": "Đề xuất",
public/locales/zh-cn.json+0 -1
@@ -1056,7 +1056,6 @@
10561056 "prompt_manager_position": "位置",
10571057 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。其他提示词旁边(相对)或在聊天中(绝对)。",
10581058 "prompt_manager_relative": "相对",
1059- "prompt_manager_absolute": "绝对",
10601059 "prompt_manager_depth": "深度",
10611060 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最后一条消息之后,1 = 在最后一条消息之前,等等。",
10621061 "Prompt": "提示词",
public/locales/zh-tw.json+0 -1
@@ -1025,7 +1025,6 @@
10251025 "prompt_manager_position": "位置",
10261026 "Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。與其他提示詞相鄰(相對位置)或在聊天中(絕對位置)。",
10271027 "prompt_manager_relative": "相對位置",
1028- "prompt_manager_absolute": "絕對位置",
10291028 "prompt_manager_depth": "深度",
10301029 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最後一條訊息之後,1 = 在最後一條訊息之前,以此類推。",
10311030 "Prompt": "提示詞",
public/scripts/group-chats.js+42 -8
@@ -70,6 +70,7 @@ import {
7070 animation_duration,
7171 depth_prompt_role_default,
7272 shouldAutoContinue,
73+ this_chid,
7374} from '../script.js';
7475import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js';
7576import { FILTER_TYPES, FilterHelper } from './filters.js';
@@ -120,6 +121,8 @@ const DEFAULT_AUTO_MODE_DELAY = 5;
120121export const groupCandidatesFilter = new FilterHelper(debounce(printGroupCandidates, debounce_timeout.quick));
121122let autoModeWorker = null;
122123const saveGroupDebounced = debounce(async (group, reload) => await _save(group, reload), debounce_timeout.relaxed);
124+/** @type {Map<string, number>} */
125+let groupChatQueueOrder = new Map();
123126
124127function setAutoModeWorker() {
125128 clearInterval(autoModeWorker);
@@ -855,9 +858,15 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
855858 const bias = getBiasStrings(userInput, type);
856859 await sendMessageAsUser(userInput, bias.messageBias);
857860 await saveChatConditional();
858861 $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles: true }));
859862 }
863+ groupChatQueueOrder = new Map();
860864
865+ if (power_user.show_group_chat_queue) {
866+ for (let i = 0; i < activatedMembers.length; ++i) {
867+ groupChatQueueOrder.set(characters[activatedMembers[i]].avatar, i + 1);
868+ }
869+ }
861870 // now the real generation begins: cycle through every activated character
862871 for (const chId of activatedMembers) {
863872 throwIfAborted();
@@ -865,6 +874,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
865874 const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat';
866875 setCharacterId(chId);
867876 setCharacterName(characters[chId].name);
877+ if (power_user.show_group_chat_queue) {
878+ printGroupMembers();
879+ }
868880 await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId);
869881
870882 if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) {
@@ -885,6 +897,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
885897 messageChunk = textResult?.messageChunk;
886898 }
887899 }
900+ if (power_user.show_group_chat_queue) {
901+ groupChatQueueOrder.delete(characters[chId].avatar);
902+ groupChatQueueOrder.forEach((value, key, map) => map.set(key, value - 1));
903+ }
888904 }
889905 } finally {
890906 typingIndicator.hide();
@@ -892,6 +908,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
892908 is_group_generating = false;
893909 setSendButtonState(false);
894910 setCharacterId(undefined);
911+ if (power_user.show_group_chat_queue) {
912+ groupChatQueueOrder = new Map();
913+ printGroupMembers();
914+ }
895915 setCharacterName('');
896916 activateSendButtons();
897917 showSwipeButtons();
@@ -1006,6 +1026,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
10061026 }
10071027 }
10081028
1029+ const chattyMembers = [];
10091030 // activation by talkativeness (in shuffled order, except banned)
10101031 const shuffledMembers = shuffle([...members]);
10111032 for (let member of shuffledMembers) {
@@ -1016,26 +1037,30 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
10161037 }
10171038
10181039 const rollValue = Math.random();
10191040 letconst talkativeness = NumberisNaN(character.talkativeness);
1020- talkativeness = Number.isNaN(talkativeness)
10211041 ? talkativeness_default
10221042 : Number(character.talkativeness);
10231043 if (talkativeness >= rollValue) {
10241044 activatedMembers.push(member);
10251045 }
1046+ if (talkativeness > 0) {
1047+ chattyMembers.push(member);
1048+ }
10261049 }
10271050
10281051 // pick 1 at random if no one was activated
10291052 let retries = 0;
1030- while (activatedMembers.length === 0 && ++retries <= members.length) {
1053+ // try to limit the selected random character to those with talkativeness > 0
1031- const randomIndex = Math.floor(Math.random() * members.length);
1054+ const randomPool = chattyMembers.length > 0 ? chattyMembers : members;
1032- const character = characters.find((x) => x.avatar === members[randomIndex]);
1055+ while (activatedMembers.length === 0 && ++retries <= randomPool.length) {
1056+ const randomIndex = Math.floor(Math.random() * randomPool.length);
1057+ const character = characters.find((x) => x.avatar === randomPool[randomIndex]);
10331058
10341059 if (!character) {
10351060 continue;
10361061 }
10371062
10381063 activatedMembers.push(membersrandomPool[randomIndex]);
10391064 }
10401065
10411066 // de-duplicate array of character avatars
@@ -1313,6 +1338,14 @@ function getGroupCharacterBlock(character) {
13131338 template.attr('chid', characters.indexOf(character));
13141339 template.find('.ch_fav').val(isFav);
13151340 template.toggleClass('is_fav', isFav);
1341+
1342+ let queuePosition = groupChatQueueOrder.get(character.avatar);
1343+ if (queuePosition) {
1344+ template.find('.queue_position').text(queuePosition);
1345+ template.toggleClass('is_queued', queuePosition > 1);
1346+ template.toggleClass('is_active', queuePosition === 1);
1347+ }
1348+
13161349 template.toggleClass('disabled', isGroupMemberDisabled(character.avatar));
13171350
13181351 // Display inline tags
@@ -1605,6 +1638,7 @@ export async function openGroupById(groupId) {
16051638 select_group_chats(groupId);
16061639
16071640 if (selected_group !== groupId) {
1641+ groupChatQueueOrder = new Map();
16081642 await clearChat();
16091643 cancelTtsPlay();
16101644 selected_group = groupId;
public/scripts/macros.js+1 -1
@@ -437,7 +437,7 @@ export function evaluateMacros(content, env) {
437437 content = replaceInstructMacros(content, env);
438438 content = replaceVariableMacros(content);
439439 content = content.replace(/{{newline}}/gi, '\n');
440440 content = content.replace(/(?:\r?\n)*{{trim}}(?:\r?\n)*/gi, '');
441441 content = content.replace(/{{noop}}/gi, '');
442442 content = content.replace(/{{input}}/gi, () => String($('#send_textarea').val()));
443443
public/scripts/power-user.js+7 -0
@@ -179,6 +179,7 @@ let power_user = {
179179 send_on_enter: send_on_enter_options.AUTO,
180180 console_log_prompts: false,
181181 request_token_probabilities: false,
182+ show_group_chat_queue: false,
182183 render_formulas: false,
183184 allow_name1_display: false,
184185 allow_name2_display: false,
@@ -1601,6 +1602,7 @@ function loadPowerUserSettings(settings, data) {
16011602
16021603 $('#console_log_prompts').prop('checked', power_user.console_log_prompts);
16031604 $('#request_token_probabilities').prop('checked', power_user.request_token_probabilities);
1605+ $('#show_group_chat_queue').prop('checked', power_user.show_group_chat_queue);
16041606 $('#auto_fix_generated_markdown').prop('checked', power_user.auto_fix_generated_markdown);
16051607 $('#auto_scroll_chat_to_bottom').prop('checked', power_user.auto_scroll_chat_to_bottom);
16061608 $('#bogus_folders').prop('checked', power_user.bogus_folders);
@@ -3567,6 +3569,11 @@ $(document).ready(() => {
35673569 saveSettingsDebounced();
35683570 });
35693571
3572+ $('#show_group_chat_queue').on('input', function () {
3573+ power_user.show_group_chat_queue = !!$(this).prop('checked');
3574+ saveSettingsDebounced();
3575+ });
3576+
35703577 $('#auto_scroll_chat_to_bottom').on('input', function () {
35713578 power_user.auto_scroll_chat_to_bottom = !!$(this).prop('checked');
35723579 saveSettingsDebounced();
public/scripts/templates/promptManagerFooter.html+6 -6
@@ -2,10 +2,10 @@
22 <select id="{{prefix}}prompt_manager_footer_append_prompt" class="text_pole" name="append-prompt">
33 {{{promptsHtml}}}
44 </select>
55 <a class="menu_button fa-chain fa-solid fa-fw" title="Insert prompt" data-i18n="[title]Insert prompt"></a>
66 <a class="caution menu_button fa-x fa-solid fa-fw" title="Delete prompt" data-i18n="[title]Delete prompt"></a>
77 <a class="menu_button fa-file-import fa-solid fa-fw" id="prompt-manager-import" title="Import a prompt list" data-i18n="[title]Import a prompt list"></a>
88 <a class="menu_button fa-file-export fa-solid fa-fw" id="prompt-manager-export" title="Export this prompt list" data-i18n="[title]Export this prompt list"></a>
99 <a class="menu_button fa-undo fa-solid fa-fw" id="prompt-manager-reset-character" title="Reset current character" data-i18n="[title]Reset current character"></a>
1010 <a class="menu_button fa-plus-square fa-solid fa-fw" title="New prompt" data-i18n="[title]New prompt"></a>
1111</div>
public/style.css+17 -0
@@ -2922,6 +2922,23 @@ input[type=search]:focus::-webkit-search-cancel-button {
29222922 position: relative;
29232923}
29242924
2925+.group_member .queue_position:not(:empty)::before {
2926+ content: "#";
2927+}
2928+
2929+.group_member .queue_position {
2930+ margin-right: 0.75rem;
2931+ font-size: calc(var(--mainFontSize) * 0.9);
2932+}
2933+
2934+.group_member.is_queued {
2935+ outline: 2px solid var(--golden);
2936+}
2937+
2938+.group_member.is_active {
2939+ outline: 2px solid var(--active);
2940+}
2941+
29252942.character_select.is_fav .avatar,
29262943.group_select.is_fav .avatar,
29272944.group_member.is_fav .avatar,