Slight performance increase for opening large World Infos
This commit is contained in:
parent
b44c72c639
commit
106f7afdcb
|
@ -3713,9 +3713,7 @@
|
||||||
<small>
|
<small>
|
||||||
<span data-i18n="Content">
|
<span data-i18n="Content">
|
||||||
Content
|
Content
|
||||||
<span>(Tokens:
|
<span>(Tokens: <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>)
|
||||||
<span class="world_entry_form_token_counter">0</span>
|
|
||||||
)
|
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</small>
|
</small>
|
||||||
|
|
|
@ -499,7 +499,7 @@ async function moduleWorker() {
|
||||||
const context = getContext();
|
const context = getContext();
|
||||||
|
|
||||||
// non-characters not supported
|
// non-characters not supported
|
||||||
if (!context.groupId && context.characterId === undefined) {
|
if (!context.groupId && (context.characterId === undefined || context.characterId === 'invalid-safety-id')) {
|
||||||
removeExpression();
|
removeExpression();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1263,6 +1263,11 @@ function updateFavButtonState(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function openGroupById(groupId) {
|
export async function openGroupById(groupId) {
|
||||||
|
if (!groups.find(x => x.id === groupId)) {
|
||||||
|
console.log('Group not found', groupId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_send_press && !is_group_generating) {
|
if (!is_send_press && !is_group_generating) {
|
||||||
if (selected_group !== groupId) {
|
if (selected_group !== groupId) {
|
||||||
cancelTtsPlay();
|
cancelTtsPlay();
|
||||||
|
|
|
@ -464,7 +464,7 @@ function appendWorldEntry(name, data, entry) {
|
||||||
|
|
||||||
const contentInput = template.find('textarea[name="content"]');
|
const contentInput = template.find('textarea[name="content"]');
|
||||||
contentInput.data("uid", entry.uid);
|
contentInput.data("uid", entry.uid);
|
||||||
contentInput.on("input", function () {
|
contentInput.on("input", function (_, { skipCount }) {
|
||||||
const uid = $(this).data("uid");
|
const uid = $(this).data("uid");
|
||||||
const value = $(this).val();
|
const value = $(this).val();
|
||||||
data.entries[uid].content = value;
|
data.entries[uid].content = value;
|
||||||
|
@ -472,12 +472,25 @@ function appendWorldEntry(name, data, entry) {
|
||||||
setOriginalDataValue(data, uid, "content", data.entries[uid].content);
|
setOriginalDataValue(data, uid, "content", data.entries[uid].content);
|
||||||
saveWorldInfo(name, data);
|
saveWorldInfo(name, data);
|
||||||
|
|
||||||
|
if (skipCount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// count tokens
|
// count tokens
|
||||||
countTokensDebounced(this, value);
|
countTokensDebounced(this, value);
|
||||||
});
|
});
|
||||||
contentInput.val(entry.content).trigger("input");
|
contentInput.val(entry.content).trigger("input", { skipCount: true });
|
||||||
//initScrollHeight(contentInput);
|
//initScrollHeight(contentInput);
|
||||||
|
|
||||||
|
template.find('.inline-drawer-toggle').on('click', function () {
|
||||||
|
const counter = template.find(".world_entry_form_token_counter");
|
||||||
|
|
||||||
|
if (counter.data('first-run')) {
|
||||||
|
counter.data('first-run', false);
|
||||||
|
countTokensDebounced(contentInput, contentInput.val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// selective
|
// selective
|
||||||
const selectiveInput = template.find('input[name="selective"]');
|
const selectiveInput = template.find('input[name="selective"]');
|
||||||
selectiveInput.data("uid", entry.uid);
|
selectiveInput.data("uid", entry.uid);
|
||||||
|
|
Loading…
Reference in New Issue