Fix make draggable

This commit is contained in:
Cohee
2024-05-24 22:00:21 +03:00
parent 8bcb1ef2db
commit 61e5c32cd2

View File

@ -6,7 +6,7 @@ import { Message, TokenHandler } from './openai.js';
import { power_user } from './power-user.js';
import { debounce, waitUntilCondition, escapeHtml } from './utils.js';
import { debounce_timeout } from './constants.js';
import { renderTemplateAsync } from './templates.js'
import { renderTemplateAsync } from './templates.js';
function debouncePromise(func, delay) {
let timeoutId;
@ -251,7 +251,7 @@ class PromptManager {
this.error = null;
/** Dry-run for generate, must return a promise */
this.tryGenerate = () => { };
this.tryGenerate = async () => { };
/** Called to persist the configuration, must return a promise */
this.saveServiceSettings = () => { };
@ -696,21 +696,23 @@ class PromptManager {
if ('character' === this.configuration.promptOrder.strategy && null === this.activeCharacter) return;
this.error = null;
waitUntilCondition(() => !is_send_press && !is_group_generating, 1024 * 1024, 100).then(() => {
waitUntilCondition(() => !is_send_press && !is_group_generating, 1024 * 1024, 100).then(async () => {
if (true === afterTryGenerate) {
// Executed during dry-run for determining context composition
this.profileStart('filling context');
this.tryGenerate().finally(() => {
this.tryGenerate().finally(async () => {
this.profileEnd('filling context');
this.profileStart('render');
this.renderPromptManager().then(() => this.renderPromptManagerListItems());
await this.renderPromptManager();
await this.renderPromptManagerListItems();
this.makeDraggable();
this.profileEnd('render');
});
} else {
// Executed during live communication
this.profileStart('render');
this.renderPromptManager().then(() => this.renderPromptManagerListItems());
await this.renderPromptManager();
await this.renderPromptManagerListItems();
this.makeDraggable();
this.profileEnd('render');
}