diff --git a/public/css/promptmanager.css b/public/css/promptmanager.css index 178682998..5370a98e8 100644 --- a/public/css/promptmanager.css +++ b/public/css/promptmanager.css @@ -233,7 +233,6 @@ } #completion_prompt_manager .completion_prompt_manager_footer a { - padding: 0.75em; font-size: 12px; } diff --git a/public/css/rm-groups.css b/public/css/rm-groups.css index e7cbb2c95..499f59873 100644 --- a/public/css/rm-groups.css +++ b/public/css/rm-groups.css @@ -68,9 +68,9 @@ margin-top: 0.25rem; margin-bottom: 0.5rem; border: 1px solid var(--SmartThemeBorderColor); - ; border-radius: 10px; background-color: var(--black30a); + padding: 2px; } #rm_group_buttons_expander { diff --git a/public/index.html b/public/index.html index 851b54228..6109568bb 100644 --- a/public/index.html +++ b/public/index.html @@ -4141,6 +4141,10 @@ Request token probabilities +
Auto-swipe @@ -5596,10 +5600,10 @@ -
Injection position. Next to other prompts (relative) or in-chat (absolute).
+
Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.
@@ -5796,6 +5800,7 @@
+
diff --git a/public/locales/ar-sa.json b/public/locales/ar-sa.json index d722b70c0..a227372b2 100644 --- a/public/locales/ar-sa.json +++ b/public/locales/ar-sa.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "موضع", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "موضع الحقن. بجوار المطالبات الأخرى (نسبية) أو داخل الدردشة (مطلقة).", "prompt_manager_relative": "نسبي", - "prompt_manager_absolute": "مطلق", "prompt_manager_depth": "عمق", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "عمق الحقن. 0 = بعد الرسالة الأخيرة، 1 = قبل الرسالة الأخيرة، الخ.", "Prompt": "موضوع", diff --git a/public/locales/de-de.json b/public/locales/de-de.json index 4551322da..fcadcbfbc 100644 --- a/public/locales/de-de.json +++ b/public/locales/de-de.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Position", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injektionsposition. Neben anderen Eingabeaufforderungen (relativ) oder im Chat (absolut).", "prompt_manager_relative": "Relativ", - "prompt_manager_absolute": "Absolut", "prompt_manager_depth": "Tiefe", "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.", "Prompt": "Aufforderung", diff --git a/public/locales/es-es.json b/public/locales/es-es.json index d4b54fa7a..36cc002bc 100644 --- a/public/locales/es-es.json +++ b/public/locales/es-es.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Posición", "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).", "prompt_manager_relative": "Relativo", - "prompt_manager_absolute": "Absoluto", "prompt_manager_depth": "Profundidad", "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.", "Prompt": "Indicar", diff --git a/public/locales/fr-fr.json b/public/locales/fr-fr.json index 84f502e8c..1b30fda0e 100644 --- a/public/locales/fr-fr.json +++ b/public/locales/fr-fr.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Position", "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).", "prompt_manager_relative": "Relatif", - "prompt_manager_absolute": "Absolu", "prompt_manager_depth": "Profondeur", "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.", "Prompt": "Inciter", diff --git a/public/locales/is-is.json b/public/locales/is-is.json index 1d5587e0c..45e5a3095 100644 --- a/public/locales/is-is.json +++ b/public/locales/is-is.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Staða", "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).", "prompt_manager_relative": "Aðstandandi", - "prompt_manager_absolute": "Algjört", "prompt_manager_depth": "Dýpt", "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.", "Prompt": "Ábending", diff --git a/public/locales/it-it.json b/public/locales/it-it.json index 18f0a3fa9..ce0f9f03a 100644 --- a/public/locales/it-it.json +++ b/public/locales/it-it.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Posizione", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posizione di iniezione. Accanto ad altri suggerimenti (relativo) o in chat (assoluto).", "prompt_manager_relative": "Parente", - "prompt_manager_absolute": "Assoluto", "prompt_manager_depth": "Profondità", "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.", "Prompt": "Prompt", diff --git a/public/locales/ja-jp.json b/public/locales/ja-jp.json index cfb6f6c79..2e18796f4 100644 --- a/public/locales/ja-jp.json +++ b/public/locales/ja-jp.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "位置", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "挿入位置。他のプロンプトの隣 (相対) またはチャット内 (絶対)。", "prompt_manager_relative": "相対的", - "prompt_manager_absolute": "絶対", "prompt_manager_depth": "深さ", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入の深さ。0 = 最後のメッセージの後、1 = 最後のメッセージの前など。", "Prompt": "プロンプト", diff --git a/public/locales/ko-kr.json b/public/locales/ko-kr.json index 1c56ff3cc..cf04e38ae 100644 --- a/public/locales/ko-kr.json +++ b/public/locales/ko-kr.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "위치", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "주입 위치. 다른 프롬프트 옆(상대적) 또는 채팅 내(절대적).", "prompt_manager_relative": "상대적인", - "prompt_manager_absolute": "순수한", "prompt_manager_depth": "깊이", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "주입 깊이. 0 = 마지막 메시지 뒤, 1 = 마지막 메시지 앞 등", "Prompt": "프롬프트", diff --git a/public/locales/nl-nl.json b/public/locales/nl-nl.json index f102ee93e..256eda091 100644 --- a/public/locales/nl-nl.json +++ b/public/locales/nl-nl.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Positie", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injectiepositie. Naast andere prompts (relatief) of in-chat (absoluut).", "prompt_manager_relative": "Familielid", - "prompt_manager_absolute": "Absoluut", "prompt_manager_depth": "Diepte", "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.", "Prompt": "Prompt", diff --git a/public/locales/pt-pt.json b/public/locales/pt-pt.json index caf918890..77bbdbafd 100644 --- a/public/locales/pt-pt.json +++ b/public/locales/pt-pt.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Posição", "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).", "prompt_manager_relative": "Relativo", - "prompt_manager_absolute": "Absoluto", "prompt_manager_depth": "Profundidade", "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.", "Prompt": "Prompt", diff --git a/public/locales/ru-ru.json b/public/locales/ru-ru.json index 2e8217605..02d19207a 100644 --- a/public/locales/ru-ru.json +++ b/public/locales/ru-ru.json @@ -1025,7 +1025,6 @@ "prompt_manager_position": "Точка инжекта", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Как рассчитывать позицию для инжекта. Она может располагаться по отношению к другим промптам (относительная) либо по отношению к чату (абсолютная).", "prompt_manager_relative": "Относительная", - "prompt_manager_absolute": "Абсолютная", "prompt_manager_depth": "Глубина", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глубина вставки. 0 = после последнего сообщения, 1 = перед последним сообщением, и т.д.", "The prompt to be sent.": "Отправляемый ИИ промпт.", diff --git a/public/locales/uk-ua.json b/public/locales/uk-ua.json index ec9c933fa..bd2ae43f1 100644 --- a/public/locales/uk-ua.json +++ b/public/locales/uk-ua.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Позиція", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Позиція ін'єкції. Поруч з іншими підказками (відносні) або в чаті (абсолютні).", "prompt_manager_relative": "Відносна", - "prompt_manager_absolute": "Абсолютний", "prompt_manager_depth": "Глибина", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глибина ін'єкції. 0 = після останнього повідомлення, 1 = перед останнім повідомленням тощо.", "Prompt": "Запит", diff --git a/public/locales/vi-vn.json b/public/locales/vi-vn.json index bfcfb4dd3..d7399ea45 100644 --- a/public/locales/vi-vn.json +++ b/public/locales/vi-vn.json @@ -1023,7 +1023,6 @@ "prompt_manager_position": "Chức vụ", "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).", "prompt_manager_relative": "Liên quan đến", - "prompt_manager_absolute": "tuyệt đối", "prompt_manager_depth": "Chiều sâu", "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.", "Prompt": "Đề xuất", diff --git a/public/locales/zh-cn.json b/public/locales/zh-cn.json index 759af7fc6..1e236dcf6 100644 --- a/public/locales/zh-cn.json +++ b/public/locales/zh-cn.json @@ -1056,7 +1056,6 @@ "prompt_manager_position": "位置", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。其他提示词旁边(相对)或在聊天中(绝对)。", "prompt_manager_relative": "相对", - "prompt_manager_absolute": "绝对", "prompt_manager_depth": "深度", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最后一条消息之后,1 = 在最后一条消息之前,等等。", "Prompt": "提示词", diff --git a/public/locales/zh-tw.json b/public/locales/zh-tw.json index cb5cb0965..e8418ef56 100644 --- a/public/locales/zh-tw.json +++ b/public/locales/zh-tw.json @@ -1025,7 +1025,6 @@ "prompt_manager_position": "位置", "Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。與其他提示詞相鄰(相對位置)或在聊天中(絕對位置)。", "prompt_manager_relative": "相對位置", - "prompt_manager_absolute": "絕對位置", "prompt_manager_depth": "深度", "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最後一條訊息之後,1 = 在最後一條訊息之前,以此類推。", "Prompt": "提示詞", diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index a9eaddd82..83f0d0a99 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -70,6 +70,7 @@ import { animation_duration, depth_prompt_role_default, shouldAutoContinue, + this_chid, } from '../script.js'; import { printTagList, createTagMapFromList, applyTagsOnCharacterSelect, tag_map, applyTagsOnGroupSelect } from './tags.js'; import { FILTER_TYPES, FilterHelper } from './filters.js'; @@ -120,6 +121,8 @@ const DEFAULT_AUTO_MODE_DELAY = 5; export const groupCandidatesFilter = new FilterHelper(debounce(printGroupCandidates, debounce_timeout.quick)); let autoModeWorker = null; const saveGroupDebounced = debounce(async (group, reload) => await _save(group, reload), debounce_timeout.relaxed); +/** @type {Map} */ +let groupChatQueueOrder = new Map(); function setAutoModeWorker() { clearInterval(autoModeWorker); @@ -855,9 +858,15 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { const bias = getBiasStrings(userInput, type); await sendMessageAsUser(userInput, bias.messageBias); await saveChatConditional(); - $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); + $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles: true })); } + groupChatQueueOrder = new Map(); + if (power_user.show_group_chat_queue) { + for (let i = 0; i < activatedMembers.length; ++i) { + groupChatQueueOrder.set(characters[activatedMembers[i]].avatar, i + 1); + } + } // now the real generation begins: cycle through every activated character for (const chId of activatedMembers) { throwIfAborted(); @@ -865,6 +874,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { const generateType = type == 'swipe' || type == 'impersonate' || type == 'quiet' || type == 'continue' ? type : 'group_chat'; setCharacterId(chId); setCharacterName(characters[chId].name); + if (power_user.show_group_chat_queue) { + printGroupMembers(); + } await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) { @@ -885,6 +897,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { messageChunk = textResult?.messageChunk; } } + if (power_user.show_group_chat_queue) { + groupChatQueueOrder.delete(characters[chId].avatar); + groupChatQueueOrder.forEach((value, key, map) => map.set(key, value - 1)); + } } } finally { typingIndicator.hide(); @@ -892,6 +908,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { is_group_generating = false; setSendButtonState(false); setCharacterId(undefined); + if (power_user.show_group_chat_queue) { + groupChatQueueOrder = new Map(); + printGroupMembers(); + } setCharacterName(''); activateSendButtons(); showSwipeButtons(); @@ -1006,6 +1026,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i } } + const chattyMembers = []; // activation by talkativeness (in shuffled order, except banned) const shuffledMembers = shuffle([...members]); for (let member of shuffledMembers) { @@ -1016,26 +1037,30 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i } const rollValue = Math.random(); - let talkativeness = Number(character.talkativeness); - talkativeness = Number.isNaN(talkativeness) + const talkativeness = isNaN(character.talkativeness) ? talkativeness_default - : talkativeness; + : Number(character.talkativeness); if (talkativeness >= rollValue) { activatedMembers.push(member); } + if (talkativeness > 0) { + chattyMembers.push(member); + } } // pick 1 at random if no one was activated let retries = 0; - while (activatedMembers.length === 0 && ++retries <= members.length) { - const randomIndex = Math.floor(Math.random() * members.length); - const character = characters.find((x) => x.avatar === members[randomIndex]); + // try to limit the selected random character to those with talkativeness > 0 + const randomPool = chattyMembers.length > 0 ? chattyMembers : members; + while (activatedMembers.length === 0 && ++retries <= randomPool.length) { + const randomIndex = Math.floor(Math.random() * randomPool.length); + const character = characters.find((x) => x.avatar === randomPool[randomIndex]); if (!character) { continue; } - activatedMembers.push(members[randomIndex]); + activatedMembers.push(randomPool[randomIndex]); } // de-duplicate array of character avatars @@ -1313,6 +1338,14 @@ function getGroupCharacterBlock(character) { template.attr('chid', characters.indexOf(character)); template.find('.ch_fav').val(isFav); template.toggleClass('is_fav', isFav); + + let queuePosition = groupChatQueueOrder.get(character.avatar); + if (queuePosition) { + template.find('.queue_position').text(queuePosition); + template.toggleClass('is_queued', queuePosition > 1); + template.toggleClass('is_active', queuePosition === 1); + } + template.toggleClass('disabled', isGroupMemberDisabled(character.avatar)); // Display inline tags @@ -1605,6 +1638,7 @@ export async function openGroupById(groupId) { select_group_chats(groupId); if (selected_group !== groupId) { + groupChatQueueOrder = new Map(); await clearChat(); cancelTtsPlay(); selected_group = groupId; diff --git a/public/scripts/macros.js b/public/scripts/macros.js index 4d201e3c9..aae0fad17 100644 --- a/public/scripts/macros.js +++ b/public/scripts/macros.js @@ -437,7 +437,7 @@ export function evaluateMacros(content, env) { content = replaceInstructMacros(content, env); content = replaceVariableMacros(content); content = content.replace(/{{newline}}/gi, '\n'); - content = content.replace(/\n*{{trim}}\n*/gi, ''); + content = content.replace(/(?:\r?\n)*{{trim}}(?:\r?\n)*/gi, ''); content = content.replace(/{{noop}}/gi, ''); content = content.replace(/{{input}}/gi, () => String($('#send_textarea').val())); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 32deaaf09..e484d2d99 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -179,6 +179,7 @@ let power_user = { send_on_enter: send_on_enter_options.AUTO, console_log_prompts: false, request_token_probabilities: false, + show_group_chat_queue: false, render_formulas: false, allow_name1_display: false, allow_name2_display: false, @@ -1601,6 +1602,7 @@ function loadPowerUserSettings(settings, data) { $('#console_log_prompts').prop('checked', power_user.console_log_prompts); $('#request_token_probabilities').prop('checked', power_user.request_token_probabilities); + $('#show_group_chat_queue').prop('checked', power_user.show_group_chat_queue); $('#auto_fix_generated_markdown').prop('checked', power_user.auto_fix_generated_markdown); $('#auto_scroll_chat_to_bottom').prop('checked', power_user.auto_scroll_chat_to_bottom); $('#bogus_folders').prop('checked', power_user.bogus_folders); @@ -3567,6 +3569,11 @@ $(document).ready(() => { saveSettingsDebounced(); }); + $('#show_group_chat_queue').on('input', function () { + power_user.show_group_chat_queue = !!$(this).prop('checked'); + saveSettingsDebounced(); + }); + $('#auto_scroll_chat_to_bottom').on('input', function () { power_user.auto_scroll_chat_to_bottom = !!$(this).prop('checked'); saveSettingsDebounced(); diff --git a/public/scripts/templates/promptManagerFooter.html b/public/scripts/templates/promptManagerFooter.html index ccd328c62..20996c58b 100644 --- a/public/scripts/templates/promptManagerFooter.html +++ b/public/scripts/templates/promptManagerFooter.html @@ -2,10 +2,10 @@ - - - - - - + + + + + +
diff --git a/public/style.css b/public/style.css index 7f1aa081a..885eafe51 100644 --- a/public/style.css +++ b/public/style.css @@ -2922,6 +2922,23 @@ input[type=search]:focus::-webkit-search-cancel-button { position: relative; } +.group_member .queue_position:not(:empty)::before { + content: "#"; +} + +.group_member .queue_position { + margin-right: 0.75rem; + font-size: calc(var(--mainFontSize) * 0.9); +} + +.group_member.is_queued { + outline: 2px solid var(--golden); +} + +.group_member.is_active { + outline: 2px solid var(--active); +} + .character_select.is_fav .avatar, .group_select.is_fav .avatar, .group_member.is_fav .avatar,