This commit is contained in:
RossAscends
2023-05-08 02:42:09 +09:00
4 changed files with 21 additions and 4 deletions

View File

@@ -1120,8 +1120,6 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true
const newMessage = $(`#chat [mesid="${count_view_mes}"]`); const newMessage = $(`#chat [mesid="${count_view_mes}"]`);
newMessage.data("isSystem", isSystem); newMessage.data("isSystem", isSystem);
appendImageToMessage(mes, newMessage);
if (isSystem) { if (isSystem) {
newMessage.find(".mes_edit").hide(); newMessage.find(".mes_edit").hide();
} }
@@ -1134,6 +1132,7 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true
if (type === 'swipe') { if (type === 'swipe') {
$("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').html(''); $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').html('');
$("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').append(messageText); $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').append(messageText);
appendImageToMessage(mes, $("#chat").find(`[mesid="${count_view_mes - 1}"]`));
$("#chat").find(`[mesid="${count_view_mes - 1}"]`).attr('title', title); $("#chat").find(`[mesid="${count_view_mes - 1}"]`).attr('title', title);
if (mes.swipe_id == mes.swipes.length - 1) { if (mes.swipe_id == mes.swipes.length - 1) {
@@ -1144,6 +1143,7 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true
} }
} else { } else {
$("#chat").find(`[mesid="${count_view_mes}"]`).find('.mes_text').append(messageText); $("#chat").find(`[mesid="${count_view_mes}"]`).find('.mes_text').append(messageText);
appendImageToMessage(mes, newMessage);
hideSwipeButtons(); hideSwipeButtons();
count_view_mes++; count_view_mes++;
} }
@@ -3773,6 +3773,7 @@ function showSwipeButtons() {
!swipes || !swipes ||
$('.mes:last').attr('mesid') <= 0 || $('.mes:last').attr('mesid') <= 0 ||
chat[chat.length - 1].is_user || chat[chat.length - 1].is_user ||
chat[chat.length - 1].extra?.image ||
count_view_mes <= 1 || count_view_mes <= 1 ||
(selected_group && is_group_generating) (selected_group && is_group_generating)
) { return; } ) { return; }
@@ -3894,7 +3895,11 @@ function isHordeGenerationNotAllowed() {
return false; return false;
} }
export function cancelTtsPlay() {
if (speechSynthesis) {
speechSynthesis.cancel();
}
}
window["SillyTavern"].getContext = function () { window["SillyTavern"].getContext = function () {
return { return {
@@ -4305,6 +4310,7 @@ $(document).ready(function () {
if (this_chid !== $(this).attr("chid")) { if (this_chid !== $(this).attr("chid")) {
//if clicked on a different character from what was currently selected //if clicked on a different character from what was currently selected
if (!is_send_press) { if (!is_send_press) {
cancelTtsPlay();
resetSelectedGroup(); resetSelectedGroup();
this_edit_mes_id = undefined; this_edit_mes_id = undefined;
selected_button = "character_edit"; selected_button = "character_edit";
@@ -5764,7 +5770,8 @@ $(document).ready(function () {
$('.code-copied').css({ 'display': 'none' }); $('.code-copied').css({ 'display': 'none' });
}); });
$(document).on('beforeunload', () => { $(window).on('beforeunload', () => {
cancelTtsPlay();
if (streamingProcessor) { if (streamingProcessor) {
console.log('Page reloaded. Aborting streaming...'); console.log('Page reloaded. Aborting streaming...');
streamingProcessor.abortController.abort(); streamingProcessor.abortController.abort();

View File

@@ -45,6 +45,7 @@ import {
setMenuType, setMenuType,
menu_type, menu_type,
select_selected_character, select_selected_character,
cancelTtsPlay,
} from "../script.js"; } from "../script.js";
import { appendTagToList, createTagMapFromList, getTagsList, applyTagsOnCharacterSelect } from './tags.js'; import { appendTagToList, createTagMapFromList, getTagsList, applyTagsOnCharacterSelect } from './tags.js';
@@ -1006,6 +1007,7 @@ async function selectGroup() {
if (!is_send_press && !is_group_generating) { if (!is_send_press && !is_group_generating) {
if (selected_group !== groupId) { if (selected_group !== groupId) {
cancelTtsPlay();
selected_group = groupId; selected_group = groupId;
setCharacterId(undefined); setCharacterId(undefined);
setCharacterName(''); setCharacterName('');

View File

@@ -185,6 +185,14 @@ Try enabling the No Blur Effect (Fast UI) mode on the User settings panel.
2. Send bug reports without providing any context 2. Send bug reports without providing any context
3. Ask the questions that were already answered numerous times 3. Ask the questions that were already answered numerous times
## Where can I find the old backgrounds?
We're moving to 100% original content only policy, so old background images have been removed from this repository.
You can find them archived here:
https://files.catbox.moe/1xevnc.zip
## Screenshots ## Screenshots
<img width="400" alt="image" src="https://user-images.githubusercontent.com/18619528/228649245-8061c60f-63dc-488e-9325-f151b7a3ec2d.png"> <img width="400" alt="image" src="https://user-images.githubusercontent.com/18619528/228649245-8061c60f-63dc-488e-9325-f151b7a3ec2d.png">
<img width="400" alt="image" src="https://user-images.githubusercontent.com/18619528/228649856-fbdeef05-d727-4d5a-be80-266cbbc6b811.png"> <img width="400" alt="image" src="https://user-images.githubusercontent.com/18619528/228649856-fbdeef05-d727-4d5a-be80-266cbbc6b811.png">