From f85b843b3ebeaed162d4b28cbbc74b7a429a7a9a Mon Sep 17 00:00:00 2001 From: David Fedolfi Date: Wed, 3 Jul 2024 17:00:10 -0400 Subject: [PATCH 01/15] - Adding display of queued speakers in group chat windows. --- public/scripts/char-data.js | 1 + public/scripts/group-chats.js | 31 +++++++++++++++++++++++++++---- public/style.css | 8 ++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/public/scripts/char-data.js b/public/scripts/char-data.js index 378c19ca3..ee87958ce 100644 --- a/public/scripts/char-data.js +++ b/public/scripts/char-data.js @@ -112,5 +112,6 @@ * @property {string} chat - name of the current chat file chat * @property {string} avatar - file name of the avatar image (acts as a unique identifier) * @property {string} json_data - the full raw JSON data of the character + * @property {number} queueOrder - Characters position in the char queue. #1 is currently generating. */ export default 0;// now this file is a module diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index a9eaddd82..5047c9dc4 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'; @@ -785,7 +786,8 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { sendSystemMessage(system_message_types.EMPTY, '', { isSmallSys: true }); return Promise.resolve(); } - + + const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId); try { throwIfAborted(); hideSwipeButtons(); @@ -857,7 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { await saveChatConditional(); $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); } - + if (showChatQueue){ + for (let i = 0; i < activatedMembers.length; ++i){ + characters[activatedMembers[i]].queueOrder = (i+1); + } + } // now the real generation begins: cycle through every activated character for (const chId of activatedMembers) { throwIfAborted(); @@ -865,6 +871,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 (showChatQueue){ + printGroupMembers(); + } await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) { @@ -885,6 +894,10 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { messageChunk = textResult?.messageChunk; } } + if (showChatQueue){ + activatedMembers.filter(chidx => characters[chidx].queueOrder > 0) + .forEach(chindex => characters[chindex].queueOrder -= 1); + } } } finally { typingIndicator.hide(); @@ -892,6 +905,14 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { is_group_generating = false; setSendButtonState(false); setCharacterId(undefined); + + if (showChatQueue){ + group.members.forEach(avatar => { + let character = characters.find(x => x.avatar === avatar || x.name === avatar); + character.queueOrder = undefined; + }); + printGroupMembers(); + } setCharacterName(''); activateSendButtons(); showSwipeButtons(); @@ -1309,11 +1330,13 @@ function getGroupCharacterBlock(character) { const isFav = character.fav || character.fav == 'true'; template.data('id', character.avatar); template.find('.avatar img').attr({ 'src': avatar, 'title': character.avatar }); - template.find('.ch_name').text(character.name); - template.attr('chid', characters.indexOf(character)); + template.find('.ch_name').text(character.name + (character.queueOrder > 0?' (#' + character.queueOrder + ')':'')); template.attr('chid', characters.indexOf(character)); template.find('.ch_fav').val(isFav); template.toggleClass('is_fav', isFav); + template.toggleClass('is_active', character.queueOrder === 1); + template.toggleClass('is_queued', character.queueOrder > 1); template.toggleClass('disabled', isGroupMemberDisabled(character.avatar)); + template.toggleClass('is_active', character.avatar === (this_chid && characters[this_chid] && characters[this_chid].avatar)); // Display inline tags const tagsElement = template.find('.tags'); diff --git a/public/style.css b/public/style.css index 7f1aa081a..0a9a1eaf8 100644 --- a/public/style.css +++ b/public/style.css @@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button { position: relative; } +.group_member.is_queued { + border: 2px solid var(--golden); +} + +.group_member.is_active { + border: 2px solid var(--active); +} + .character_select.is_fav .avatar, .group_select.is_fav .avatar, .group_member.is_fav .avatar, From 2fccd83083b714e165eda5102112b7b21ba4865c Mon Sep 17 00:00:00 2001 From: David Fedolfi Date: Thu, 4 Jul 2024 09:52:56 -0400 Subject: [PATCH 02/15] Group Chat Queue Display - removing queue position from character object - storing in map in group_chat.js instead - moving queue position to div - moving '#' from js to css ::before - adding option to settings - cleaning up guards --- public/index.html | 5 +++++ public/scripts/group-chats.js | 35 +++++++++++++++++++---------------- public/scripts/power-user.js | 7 +++++++ public/style.css | 8 ++++++++ 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/public/index.html b/public/index.html index 61ce9e14d..1d37f0ed6 100644 --- a/public/index.html +++ b/public/index.html @@ -4141,6 +4141,10 @@ Request token probabilities +
Auto-swipe @@ -5796,6 +5800,7 @@
+
diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 5047c9dc4..7a5f4f24d 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -121,6 +121,7 @@ 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); +let groupChatQueueOrder = new Map(); function setAutoModeWorker() { clearInterval(autoModeWorker); @@ -787,7 +788,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { return Promise.resolve(); } - const showChatQueue = (!(typingIndicator.length === 0 && !isStreamingEnabled()) && openGroupId); try { throwIfAborted(); hideSwipeButtons(); @@ -859,9 +859,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { await saveChatConditional(); $('#send_textarea').val('')[0].dispatchEvent(new Event('input', { bubbles:true })); } - if (showChatQueue){ + groupChatQueueOrder = new Map(); + + if (power_user.show_group_chat_queue){ for (let i = 0; i < activatedMembers.length; ++i){ - characters[activatedMembers[i]].queueOrder = (i+1); + groupChatQueueOrder.set(characters[activatedMembers[i]].avatar, i+1); } } // now the real generation begins: cycle through every activated character @@ -871,7 +873,7 @@ 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 (showChatQueue){ + if (power_user.show_group_chat_queue){ printGroupMembers(); } await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId); @@ -894,9 +896,9 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { messageChunk = textResult?.messageChunk; } } - if (showChatQueue){ - activatedMembers.filter(chidx => characters[chidx].queueOrder > 0) - .forEach(chindex => characters[chindex].queueOrder -= 1); + if (power_user.show_group_chat_queue){ + groupChatQueueOrder.delete(characters[chId].avatar); + groupChatQueueOrder.forEach((value, key, map) => map.set(key, value-1)); } } } finally { @@ -905,12 +907,8 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) { is_group_generating = false; setSendButtonState(false); setCharacterId(undefined); - - if (showChatQueue){ - group.members.forEach(avatar => { - let character = characters.find(x => x.avatar === avatar || x.name === avatar); - character.queueOrder = undefined; - }); + if (power_user.show_group_chat_queue){ + groupChatQueueOrder = new Map(); printGroupMembers(); } setCharacterName(''); @@ -1333,10 +1331,15 @@ function getGroupCharacterBlock(character) { template.find('.ch_name').text(character.name + (character.queueOrder > 0?' (#' + character.queueOrder + ')':'')); template.attr('chid', characters.indexOf(character)); template.find('.ch_fav').val(isFav); template.toggleClass('is_fav', isFav); - template.toggleClass('is_active', character.queueOrder === 1); - template.toggleClass('is_queued', character.queueOrder > 1); + + 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)); - template.toggleClass('is_active', character.avatar === (this_chid && characters[this_chid] && characters[this_chid].avatar)); // Display inline tags const tagsElement = template.find('.tags'); 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/style.css b/public/style.css index 0a9a1eaf8..c079917da 100644 --- a/public/style.css +++ b/public/style.css @@ -2922,6 +2922,14 @@ input[type=search]:focus::-webkit-search-cancel-button { position: relative; } +.group_member .queue_position:not(:empty)::before { + content: "#"; +} + +.group_member .queue_position{ + margin-right: 1rem; +} + .group_member.is_queued { border: 2px solid var(--golden); } From e097e42ff8dd28ac424f51466bc056f43bad5e5e Mon Sep 17 00:00:00 2001 From: David Fedolfi Date: Thu, 4 Jul 2024 10:25:48 -0400 Subject: [PATCH 03/15] Tweaking activateNaturalOrder Changes to activateNaturalOrder to try to keep silent characters silent. --- public/scripts/group-chats.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index a9eaddd82..6ae1c0325 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -1006,6 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i } } + let chattyMembers = []; // activation by talkativeness (in shuffled order, except banned) const shuffledMembers = shuffle([...members]); for (let member of shuffledMembers) { @@ -1023,19 +1024,24 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i 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 + let 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 From ddcce55f10d56b9b2ebe21d8236b47716f4a9ade Mon Sep 17 00:00:00 2001 From: Succubyss <87207237+Succubyss@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:57:29 -0500 Subject: [PATCH 04/15] Changes the name of the `Absolute` label for Position within Prompt Manager's edit screen to `In-chat` (#2470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bad dumb label: Absolute → good actual label: In-chat * Fix i18n attribute --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com> --- public/index.html | 4 ++-- public/locales/ar-sa.json | 1 - public/locales/de-de.json | 1 - public/locales/es-es.json | 1 - public/locales/is-is.json | 1 - public/locales/it-it.json | 1 - public/locales/ja-jp.json | 1 - public/locales/ko-kr.json | 1 - public/locales/pt-pt.json | 1 - public/locales/ru-ru.json | 1 - public/locales/uk-ua.json | 1 - public/locales/vi-vn.json | 1 - public/locales/zh-cn.json | 1 - public/locales/zh-tw.json | 1 - 14 files changed, 2 insertions(+), 15 deletions(-) diff --git a/public/index.html b/public/index.html index 851b54228..29fc45ad0 100644 --- a/public/index.html +++ b/public/index.html @@ -5596,10 +5596,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.
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/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/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": "提示詞", From 73ac6475bdb921b24e85680966c32d99a66cddc2 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:59:39 +0300 Subject: [PATCH 05/15] Restyle PM buttons --- public/css/promptmanager.css | 1 - public/scripts/templates/promptManagerFooter.html | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) 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/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 @@ - - - - - - + + + + + +
From 558f6d15a5351cd446b274ed547d174c5edd12c2 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Thu, 4 Jul 2024 19:05:03 +0200 Subject: [PATCH 06/15] Fix trim macro breaking on CRLF --- public/scripts/macros.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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())); From 3918192dee20e9d1a8e6ae25c4a461cc7a1f7648 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 4 Jul 2024 20:06:44 +0300 Subject: [PATCH 07/15] Prefer const variables --- public/scripts/group-chats.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 6ae1c0325..4e4b255f2 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -855,7 +855,7 @@ 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 })); } // now the real generation begins: cycle through every activated character @@ -1006,7 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i } } - let chattyMembers = []; + const chattyMembers = []; // activation by talkativeness (in shuffled order, except banned) const shuffledMembers = shuffle([...members]); for (let member of shuffledMembers) { @@ -1017,14 +1017,13 @@ 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){ + if (talkativeness > 0) { chattyMembers.push(member); } } @@ -1032,7 +1031,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i // pick 1 at random if no one was activated let retries = 0; // try to limit the selected random character to those with talkativeness > 0 - let randomPool = chattyMembers.length > 0? chattyMembers : members; + 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]); From a4a0ec16698662988d1f5e5e373f59e8bbec09bb Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Thu, 4 Jul 2024 20:12:58 +0300 Subject: [PATCH 08/15] Fix i18n attributes --- public/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 1d37f0ed6..c2aaecde8 100644 --- a/public/index.html +++ b/public/index.html @@ -4141,9 +4141,9 @@ Request token probabilities -