mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add group scenario override
This commit is contained in:
@ -1712,6 +1712,7 @@
|
|||||||
<div id="rm_group_chats_block" class="right_menu">
|
<div id="rm_group_chats_block" class="right_menu">
|
||||||
<div id="rm_group_top_bar">
|
<div id="rm_group_top_bar">
|
||||||
<div id="rm_button_back_from_group" class="menu_button fa-solid fa-left-long"></div>
|
<div id="rm_button_back_from_group" class="menu_button fa-solid fa-left-long"></div>
|
||||||
|
<div id="rm_group_scenario" class="menu_button fa-solid fa-scroll" title="Set a group chat scenario"></div>
|
||||||
<input id="rm_group_chat_name" class="text_pole" type="text" name="chat_name" placeholder="Chat Name (Optional)" maxlength="100" />
|
<input id="rm_group_chat_name" class="text_pole" type="text" name="chat_name" placeholder="Chat Name (Optional)" maxlength="100" />
|
||||||
<div id="group_favorite_button" class="menu_button fa-solid fa-star" title="Add to Favorites"></div>
|
<div id="group_favorite_button" class="menu_button fa-solid fa-star" title="Add to Favorites"></div>
|
||||||
<input id="rm_group_fav" type="hidden" />
|
<input id="rm_group_fav" type="hidden" />
|
||||||
@ -1949,6 +1950,21 @@
|
|||||||
|
|
||||||
<!-- templates for JS to reuse when needed -->
|
<!-- templates for JS to reuse when needed -->
|
||||||
|
|
||||||
|
<div id="group_scenario_template" class="template_element">
|
||||||
|
<div class="group_scenario range-block flexFlowColumn flex-container">
|
||||||
|
<div class="range-block-title title_restorable">
|
||||||
|
<h3>Group Chat Scenario Override</h3>
|
||||||
|
<div title="Remove" class="menu_button fa-solid fa-trash-can remove_scenario_override"></div>
|
||||||
|
</div>
|
||||||
|
<div class="range-block-counter justifyLeft flex-container flexFlowColumn">
|
||||||
|
All group members will use the following scenario text instead of what is specified in their character cards.
|
||||||
|
</div>
|
||||||
|
<div class="range-block-range wide100p">
|
||||||
|
<textarea class="wide100p group_chat_scenario" class="text_pole" rows="5" placeholder="Type here..."></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="past_chat_template" class="template_element">
|
<div id="past_chat_template" class="template_element">
|
||||||
<div class="select_chat_block_wrapper">
|
<div class="select_chat_block_wrapper">
|
||||||
<div class="select_chat_block" file_name="">
|
<div class="select_chat_block" file_name="">
|
||||||
|
@ -1632,9 +1632,10 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
addOneMessage(chat[chat.length - 1]);
|
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 charDescription = baseChatReplace($.trim(characters[this_chid].description), name1, name2);
|
||||||
let charPersonality = baseChatReplace($.trim(characters[this_chid].personality), 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);
|
let mesExamples = baseChatReplace($.trim(characters[this_chid].mes_example), name1, name2);
|
||||||
|
|
||||||
// Parse example messages
|
// Parse example messages
|
||||||
|
@ -449,11 +449,11 @@ async function generateGroupWrapper(by_auto_mode, type = null, force_chid = null
|
|||||||
|
|
||||||
const resolveOriginal = params.resolve;
|
const resolveOriginal = params.resolve;
|
||||||
const rejectOriginal = params.reject;
|
const rejectOriginal = params.reject;
|
||||||
params.resolve = function() {
|
params.resolve = function () {
|
||||||
isQuietGenDone = true;
|
isQuietGenDone = true;
|
||||||
resolveOriginal.apply(this, arguments);
|
resolveOriginal.apply(this, arguments);
|
||||||
};
|
};
|
||||||
params.reject = function() {
|
params.reject = function () {
|
||||||
isQuietGenDone = true;
|
isQuietGenDone = true;
|
||||||
rejectOriginal.apply(this, arguments);
|
rejectOriginal.apply(this, arguments);
|
||||||
}
|
}
|
||||||
@ -909,9 +909,11 @@ function select_group_chats(groupId, skipAnimation) {
|
|||||||
if (groupId) {
|
if (groupId) {
|
||||||
$("#rm_group_submit").hide();
|
$("#rm_group_submit").hide();
|
||||||
$("#rm_group_delete").show();
|
$("#rm_group_delete").show();
|
||||||
|
$("#rm_group_scenario").show();
|
||||||
} else {
|
} else {
|
||||||
$("#rm_group_submit").show();
|
$("#rm_group_submit").show();
|
||||||
$("#rm_group_delete").hide();
|
$("#rm_group_delete").hide();
|
||||||
|
$("#rm_group_scenario").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#rm_group_delete").off();
|
$("#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(() => {
|
jQuery(() => {
|
||||||
$(document).on("click", ".group_select", selectGroup);
|
$(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);
|
$("#rm_group_filter").on("input", filterGroupMembers);
|
||||||
$("#group_fav_filter").on("click", toggleFilterByFavorites);
|
$("#group_fav_filter").on("click", toggleFilterByFavorites);
|
||||||
$("#rm_group_submit").on("click", createGroup);
|
$("#rm_group_submit").on("click", createGroup);
|
||||||
|
$("#rm_group_scenario").on("click", setGroupScenario);
|
||||||
$("#rm_group_automode").on("input", function () {
|
$("#rm_group_automode").on("input", function () {
|
||||||
const value = $(this).prop("checked");
|
const value = $(this).prop("checked");
|
||||||
is_group_automode_enabled = value;
|
is_group_automode_enabled = value;
|
||||||
|
@ -3632,7 +3632,8 @@ toolcool-color-picker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.openai_restorable,
|
.openai_restorable,
|
||||||
.poe_restorable {
|
.poe_restorable,
|
||||||
|
.title_restorable {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
Reference in New Issue
Block a user