+
diff --git a/public/scripts/group-chats.js b/public/scripts/group-chats.js
index 2d4f2bbbf..eb8d75a61 100644
--- a/public/scripts/group-chats.js
+++ b/public/scripts/group-chats.js
@@ -101,6 +101,11 @@ export const group_activation_strategy = {
LIST: 1,
};
+export const group_generation_mode = {
+ SWAP: 0,
+ APPEND: 1,
+}
+
export const groupCandidatesFilter = new FilterHelper(debounce(printGroupCandidates, 100));
const groupAutoModeInterval = setInterval(groupChatAutoModeWorker, 5000);
const saveGroupDebounced = debounce(async (group, reload) => await _save(group, reload), 500);
@@ -922,6 +927,14 @@ async function onGroupActivationStrategyInput(e) {
}
}
+async function onGroupGenerationModeInput(e) {
+ if (openGroupId) {
+ let _thisGroup = groups.find((x) => x.id == openGroupId);
+ _thisGroup.generation_mode = Number(e.target.value);
+ await editGroup(openGroupId, false, false);
+ }
+}
+
async function onGroupNameInput() {
if (openGroupId) {
let _thisGroup = groups.find((x) => x.id == openGroupId);
@@ -1085,12 +1098,16 @@ function select_group_chats(groupId, skipAnimation) {
const group = openGroupId && groups.find((x) => x.id == openGroupId);
const groupName = group?.name ?? "";
const replyStrategy = Number(group?.activation_strategy ?? group_activation_strategy.NATURAL);
+ const generationMode = Number(group?.generation_mode ?? group_generation_mode.DEFAULT);
setMenuType(!!group ? 'group_edit' : 'group_create');
$("#group_avatar_preview").empty().append(getGroupAvatar(group));
$("#rm_group_restore_avatar").toggle(!!group && isValidImageUrl(group.avatar_url));
$("#rm_group_filter").val("").trigger("input");
- $(`input[name="rm_group_activation_strategy"][value="${replyStrategy}"]`).prop('checked', true);
+ $("#rm_group_activation_strategy").val(replyStrategy);
+ $(`#rm_group_activation_strategy option[value="${replyStrategy}"]`).prop('selected', true);
+ $("#rm_group_generation_mode").val(generationMode);
+ $(`#rm_group_generation_mode option[value="${generationMode}"]`).prop('selected', true);
$("#rm_group_chat_name").val(groupName);
if (!skipAnimation) {
@@ -1311,8 +1328,9 @@ function filterGroupMembers() {
async function createGroup() {
let name = $("#rm_group_chat_name").val();
- let allow_self_responses = !!$("#rm_group_allow_self_responses").prop("checked");
- let activation_strategy = $('input[name="rm_group_activation_strategy"]:checked').val() ?? group_activation_strategy.NATURAL;
+ let allowSelfResponses = !!$("#rm_group_allow_self_responses").prop("checked");
+ let activationStrategy = Number($('#rm_group_activation_strategy').find(':selected').val()) ?? group_activation_strategy.NATURAL;
+ let generationMode = Number($('#rm_group_generation_mode').find(':selected').val()) ?? group_generation_mode.SWAP;
const members = newGroupMembers;
const memberNames = characters.filter(x => members.includes(x.avatar)).map(x => x.name).join(", ");
@@ -1332,8 +1350,9 @@ async function createGroup() {
name: name,
members: members,
avatar_url: isValidImageUrl(avatar_url) ? avatar_url : default_avatar,
- allow_self_responses: allow_self_responses,
- activation_strategy: activation_strategy,
+ allow_self_responses: allowSelfResponses,
+ activation_strategy: activationStrategy,
+ generation_mode: generationMode,
disabled_members: [],
chat_metadata: {},
fav: fav_grp_checked,
@@ -1605,7 +1624,8 @@ jQuery(() => {
$("#rm_group_delete").off().on("click", onDeleteGroupClick);
$("#group_favorite_button").on('click', onFavoriteGroupClick);
$("#rm_group_allow_self_responses").on("input", onGroupSelfResponsesClick);
- $('input[name="rm_group_activation_strategy"]').on("input", onGroupActivationStrategyInput);
+ $("#rm_group_activation_strategy").on("change", onGroupActivationStrategyInput);
+ $("#rm_group_generation_mode").on("change", onGroupGenerationModeInput);
$("#group_avatar_button").on("input", uploadGroupAvatar);
$("#rm_group_restore_avatar").on("click", restoreGroupAvatar);
$(document).on("click", ".group_member .right_menu_button", onGroupActionClick);
diff --git a/server.js b/server.js
index dec4ae0a6..94dcc9ace 100644
--- a/server.js
+++ b/server.js
@@ -2573,6 +2573,7 @@ app.post('/creategroup', jsonParser, (request, response) => {
avatar_url: request.body.avatar_url,
allow_self_responses: !!request.body.allow_self_responses,
activation_strategy: request.body.activation_strategy ?? 0,
+ generation_mode: request.body.generation_mode ?? 0,
disabled_members: request.body.disabled_members ?? [],
chat_metadata: request.body.chat_metadata ?? {},
fav: request.body.fav,