mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Improvements to group chats
This commit is contained in:
@@ -924,15 +924,15 @@
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkWorldInfo(chat) {
|
function substituteParams(content) {
|
||||||
function substituteParams(content) {
|
content = content.replace(/{{user}}/gi, name1);
|
||||||
content = content.replace(/{{user}}/gi, name1);
|
content = content.replace(/{{char}}/gi, name2);
|
||||||
content = content.replace(/{{char}}/gi, name2);
|
content = content.replace(/<USER>/gi, name1);
|
||||||
content = content.replace(/<USER>/gi, name1);
|
content = content.replace(/<BOT>/gi, name2);
|
||||||
content = content.replace(/<BOT>/gi, name2);
|
return content;
|
||||||
return content;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
function checkWorldInfo(chat) {
|
||||||
if (world_info_data.entries.length == 0) {
|
if (world_info_data.entries.length == 0) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1017,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newMessage = { ... systemMessage, 'send_date': Date.now() };
|
const newMessage = { ... systemMessage, 'send_date': humanizedISO8601DateTime() };
|
||||||
chat.push(newMessage);
|
chat.push(newMessage);
|
||||||
addOneMessage(newMessage);
|
addOneMessage(newMessage);
|
||||||
is_send_press = false;
|
is_send_press = false;
|
||||||
@@ -1669,7 +1669,7 @@
|
|||||||
if (type === 'group_chat') {
|
if (type === 'group_chat') {
|
||||||
let avatarImg = 'img/fluffy.png';
|
let avatarImg = 'img/fluffy.png';
|
||||||
if (characters[this_chid].avatar != 'none'){
|
if (characters[this_chid].avatar != 'none'){
|
||||||
avatarImg = `characters/${characters[this_chid].avatar}`;
|
avatarImg = `characters/${characters[this_chid].avatar}?${Date.now()}`;
|
||||||
}
|
}
|
||||||
chat[chat.length-1]['is_name'] = true;
|
chat[chat.length-1]['is_name'] = true;
|
||||||
chat[chat.length-1]['force_avatar'] = avatarImg;
|
chat[chat.length-1]['force_avatar'] = avatarImg;
|
||||||
@@ -2112,6 +2112,27 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sendSystemMessage(system_message_types.GROUP);
|
sendSystemMessage(system_message_types.GROUP);
|
||||||
|
const group = groups.find(x => x.id === id);
|
||||||
|
if (group && Array.isArray(group.members)) {
|
||||||
|
for (let name of group.members) {
|
||||||
|
const character = characters.find(x => x.name === name);
|
||||||
|
|
||||||
|
if (!character) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mes = {};
|
||||||
|
mes['is_user'] = false;
|
||||||
|
mes['is_system'] = false;
|
||||||
|
mes['name'] = character.name;
|
||||||
|
mes['is_name'] = true;
|
||||||
|
mes['send_date'] = humanizedISO8601DateTime();
|
||||||
|
mes['mes'] = character.first_mes ? substituteParams(character.first_mes.trim()) : mes['mes'] = default_ch_mes;
|
||||||
|
mes['force_avatar'] = character.avatar != 'none' ? `characters/${character.avatar}?${Date.now()}` : 'img/fluffy.png';
|
||||||
|
chat.push(mes);
|
||||||
|
addOneMessage(mes);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveGroupChat(id);
|
await saveGroupChat(id);
|
||||||
@@ -2453,7 +2474,7 @@
|
|||||||
if(characters[chid].avatar != 'none'){
|
if(characters[chid].avatar != 'none'){
|
||||||
this_avatar = "characters/"+characters[chid].avatar;
|
this_avatar = "characters/"+characters[chid].avatar;
|
||||||
}
|
}
|
||||||
$("#avatar_load_preview").attr('src',this_avatar+"#"+Date.now());
|
$("#avatar_load_preview").attr('src',this_avatar+"?"+Date.now());
|
||||||
$("#name_div").css("display", "none");
|
$("#name_div").css("display", "none");
|
||||||
|
|
||||||
$("#form_create").attr("actiontype", "editcharacter");
|
$("#form_create").attr("actiontype", "editcharacter");
|
||||||
@@ -3806,7 +3827,7 @@
|
|||||||
//********************
|
//********************
|
||||||
//***Message Editor***
|
//***Message Editor***
|
||||||
$(document).on('click', '.mes_edit', function(){
|
$(document).on('click', '.mes_edit', function(){
|
||||||
if(this_chid !== undefined){
|
if(this_chid !== undefined || selected_group){
|
||||||
const message = $(this).closest('.mes');
|
const message = $(this).closest('.mes');
|
||||||
|
|
||||||
if (message.data('isSystem')) {
|
if (message.data('isSystem')) {
|
||||||
@@ -3842,7 +3863,11 @@
|
|||||||
var text = chat[edit_mes_id]['mes'];
|
var text = chat[edit_mes_id]['mes'];
|
||||||
if(chat[edit_mes_id]['is_user']){
|
if(chat[edit_mes_id]['is_user']){
|
||||||
this_edit_mes_chname = name1;
|
this_edit_mes_chname = name1;
|
||||||
}else{
|
}
|
||||||
|
else if (chat[edit_mes_id]['forced_avatar']) {
|
||||||
|
this_edit_mes_chname = chat[edit_mes_id]['name'];
|
||||||
|
}
|
||||||
|
else{
|
||||||
this_edit_mes_chname = name2;
|
this_edit_mes_chname = name2;
|
||||||
}
|
}
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
@@ -5121,9 +5146,9 @@
|
|||||||
<input id="rm_group_automode" type="checkbox" /><span></span>
|
<input id="rm_group_automode" type="checkbox" /><span></span>
|
||||||
<h4>Auto Mode</h4>
|
<h4>Auto Mode</h4>
|
||||||
</label>
|
</label>
|
||||||
<input id="rm_group_submit" type="button" value="Create">
|
<input id="rm_group_submit" class="menu_button" type="submit" value="Create">
|
||||||
<div id="rm_group_buttons_expander"> </div>
|
<div id="rm_group_buttons_expander"> </div>
|
||||||
<input id="rm_group_delete" type="button" value="Delete">
|
<input id="rm_group_delete" class="menu_button" type="submit" value="Delete">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="rm_api_block" class="right_menu" >
|
<div id="rm_api_block" class="right_menu" >
|
||||||
|
@@ -1861,7 +1861,7 @@ border-radius: 5px;
|
|||||||
#rm_group_top_bar {
|
#rm_group_top_bar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: flex-start;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
#rm_button_group_chats{
|
#rm_button_group_chats{
|
||||||
|
Reference in New Issue
Block a user