mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Introduce a state lock to prompt manager render function
This commit is contained in:
@@ -183,6 +183,9 @@ function PromptManagerModule() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Either 0 for done or 1 for rendering
|
||||||
|
this.renderState = 0;
|
||||||
|
|
||||||
// Chatcompletion configuration object
|
// Chatcompletion configuration object
|
||||||
this.serviceSettings = null;
|
this.serviceSettings = null;
|
||||||
|
|
||||||
@@ -589,8 +592,10 @@ PromptManagerModule.prototype.init = function (moduleConfiguration, serviceSetti
|
|||||||
*/
|
*/
|
||||||
PromptManagerModule.prototype.render = function (afterTryGenerate = true) {
|
PromptManagerModule.prototype.render = function (afterTryGenerate = true) {
|
||||||
if (main_api !== 'openai' ||
|
if (main_api !== 'openai' ||
|
||||||
null === this.activeCharacter) return;
|
null === this.activeCharacter ||
|
||||||
|
1 === this.renderState) return;
|
||||||
|
|
||||||
|
this.renderState = 1;
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
||||||
const stopPropagation = (event) => {
|
const stopPropagation = (event) => {
|
||||||
@@ -627,6 +632,7 @@ PromptManagerModule.prototype.render = function (afterTryGenerate = true) {
|
|||||||
this.log(error.stack);
|
this.log(error.stack);
|
||||||
this.log('-----------------------------------------------------------');
|
this.log('-----------------------------------------------------------');
|
||||||
} finally {
|
} finally {
|
||||||
|
this.renderState = 0;
|
||||||
configurationContainer.removeEventListener('click', stopPropagation, true);
|
configurationContainer.removeEventListener('click', stopPropagation, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user