Move typing indicator to an extension

https://github.com/SillyTavern/Extension-TypingIndicator
This commit is contained in:
Cohee
2025-02-02 03:54:14 +02:00
parent 1f0aa29307
commit 6deaa31d41
4 changed files with 1 additions and 44 deletions

View File

@ -4830,6 +4830,7 @@
</div>
<div id="extensions_settings" class="flex1 wide50p">
<div id="assets_container" class="extension_container"></div>
<div id="typing_indicator_container" class="extension_container"></div>
<div id="expressions_container" class="extension_container"></div>
<div id="sd_container" class="extension_container"></div>
<div id="tts_container" class="extension_container"></div>
@ -6473,9 +6474,6 @@
</div>
<!-- chat and input bar -->
<div id="typing_indicator_template" class="template_element">
<div class="typing_indicator"><span class="typing_indicator_name">CHAR</span> is typing</div>
</div>
<div id="message_file_template" class="template_element">
<div class="mes_file_container">
<div class="fa-lg fa-solid fa-file-alt mes_file_icon"></div>

View File

@ -8738,11 +8738,6 @@ const swipe_right = () => {
easing: animation_easing,
queue: false,
complete: async function () {
/*if (!selected_group) {
var typingIndicator = $("#typing_indicator_template .typing_indicator").clone();
typingIndicator.find(".typing_indicator_name").text(characters[this_chid].name);
} */
/* $("#chat").append(typingIndicator); */
const is_animation_scroll = ($('#chat').scrollTop() >= ($('#chat').prop('scrollHeight') - $('#chat').outerHeight()) - 10);
//console.log(parseInt(chat[chat.length-1]['swipe_id']));
//console.log(chat[chat.length-1]['swipes'].length);

View File

@ -818,7 +818,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
/** @type {any} Caution: JS war crimes ahead */
let textResult = '';
let typingIndicator = $('#chat .typing_indicator');
const group = groups.find((x) => x.id === selected_group);
if (!group || !Array.isArray(group.members) || !group.members.length) {
@ -834,14 +833,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
setCharacterId(undefined);
const userInput = String($('#send_textarea').val());
if (typingIndicator.length === 0 && !isStreamingEnabled()) {
typingIndicator = $(
'#typing_indicator_template .typing_indicator',
).clone();
typingIndicator.hide();
$('#chat').append(typingIndicator);
}
// id of this specific batch for regeneration purposes
group_generation_id = Date.now();
const lastMessage = chat[chat.length - 1];
@ -919,14 +910,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
}
await eventSource.emit(event_types.GROUP_MEMBER_DRAFTED, chId);
if (type !== 'swipe' && type !== 'impersonate' && !isStreamingEnabled()) {
// update indicator and scroll down
typingIndicator
.find('.typing_indicator_name')
.text(characters[chId].name);
typingIndicator.show();
}
// Wait for generation to finish
textResult = await Generate(generateType, { automatic_trigger: by_auto_mode, ...(params || {}) });
let messageChunk = textResult?.messageChunk;
@ -943,8 +926,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
}
}
} finally {
typingIndicator.hide();
is_group_generating = false;
setSendButtonState(false);
setCharacterId(undefined);

View File

@ -4602,23 +4602,6 @@ body .ui-widget-content li:hover {
opacity: 1;
}
.typing_indicator {
position: sticky;
bottom: 10px;
margin: 10px;
opacity: 0.85;
text-shadow: 0px 0px calc(var(--shadowWidth) * 1px) var(--SmartThemeShadowColor);
order: 9999;
}
.typing_indicator:after {
display: inline-block;
vertical-align: bottom;
animation: ellipsis steps(4, end) 1500ms infinite;
content: "";
width: 0px;
}
#group_avatar_preview .missing-avatar {
display: inline;
vertical-align: middle;