diff --git a/public/index.html b/public/index.html index 99a9913c4..6c3b272f0 100644 --- a/public/index.html +++ b/public/index.html @@ -1712,6 +1712,7 @@
+ @@ -1949,6 +1950,21 @@ +
+
+
+

Group Chat Scenario Override

+ +
+
+ All group members will use the following scenario text instead of what is specified in their character cards. +
+
+ +
+
+
+
diff --git a/public/script.js b/public/script.js index a89e19d93..054481571 100644 --- a/public/script.js +++ b/public/script.js @@ -1632,9 +1632,10 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, addOneMessage(chat[chat.length - 1]); } //////////////////////////////////// + const scenarioText = chat_metadata['scenario'] || characters[this_chid].scenario; let charDescription = baseChatReplace($.trim(characters[this_chid].description), name1, name2); let charPersonality = baseChatReplace($.trim(characters[this_chid].personality), name1, name2); - let Scenario = baseChatReplace($.trim(characters[this_chid].scenario), name1, name2); + let Scenario = baseChatReplace($.trim(scenarioText), name1, name2); let mesExamples = baseChatReplace($.trim(characters[this_chid].mes_example), name1, name2); // Parse example messages diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js index 20b2568e0..96cd2ae9e 100644 --- a/public/scripts/group-chats.js +++ b/public/scripts/group-chats.js @@ -449,11 +449,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, force_chid = null const resolveOriginal = params.resolve; const rejectOriginal = params.reject; - params.resolve = function() { + params.resolve = function () { isQuietGenDone = true; resolveOriginal.apply(this, arguments); }; - params.reject = function() { + params.reject = function () { isQuietGenDone = true; rejectOriginal.apply(this, arguments); } @@ -909,9 +909,11 @@ function select_group_chats(groupId, skipAnimation) { if (groupId) { $("#rm_group_submit").hide(); $("#rm_group_delete").show(); + $("#rm_group_scenario").show(); } else { $("#rm_group_submit").show(); $("#rm_group_delete").hide(); + $("#rm_group_scenario").hide(); } $("#rm_group_delete").off(); @@ -1264,11 +1266,35 @@ export async function saveGroupBookmarkChat(groupId, name, metadata) { }); } +function setGroupScenario() { + if (!selected_group) { + return; + } + + const template = $('#group_scenario_template .group_scenario').clone(); + const metadataValue = chat_metadata['scenario'] || ''; + template.find('.group_chat_scenario').text(metadataValue); + callPopup(template.get(0).outerHTML, 'text'); +} + +function onGroupScenarioInput() { + const value = $(this).val(); + const metadata = { scenario: value, }; + updateChatMetadata(metadata, false); +} + +function onGroupScenarioRemoveClick() { + $(this).closest('.group_scenario').find('.group_chat_scenario').val('').trigger('input'); +} + jQuery(() => { $(document).on("click", ".group_select", selectGroup); + $(document).on("input", ".group_chat_scenario", onGroupScenarioInput); + $(document).on("click", ".remove_scenario_override", onGroupScenarioRemoveClick); $("#rm_group_filter").on("input", filterGroupMembers); $("#group_fav_filter").on("click", toggleFilterByFavorites); $("#rm_group_submit").on("click", createGroup); + $("#rm_group_scenario").on("click", setGroupScenario); $("#rm_group_automode").on("input", function () { const value = $(this).prop("checked"); is_group_automode_enabled = value; diff --git a/public/style.css b/public/style.css index 1dfc8ec4c..551f9f480 100644 --- a/public/style.css +++ b/public/style.css @@ -3632,7 +3632,8 @@ toolcool-color-picker { } .openai_restorable, -.poe_restorable { +.poe_restorable, +.title_restorable { display: flex; flex-direction: row; justify-content: space-between;