Skip to content

Commit 5e7c026

Browse files
committed
stop generating audio msg on error
1 parent 9f42c87 commit 5e7c026

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

js/widgets/sampler.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,14 @@ function SampleWidget() {
596596
const prompt = textArea.value;
597597
const encodedPrompt = encodeURIComponent(prompt);
598598
const url = `http://localhost:8000/generate?prompt=${encodedPrompt}`;
599+
600+
let blinkInterval;
601+
599602
try {
600603
generating = true;
601604
activity.textMsg(_("Generating Audio..."), 2500);
602605

603-
let blinkInterval = setInterval(() => {
606+
blinkInterval = setInterval(() => {
604607
activity.textMsg(_("Generating Audio..."), 1000);
605608
}, 5000);
606609

@@ -620,7 +623,9 @@ function SampleWidget() {
620623
}
621624
} catch (error) {
622625
generating = false;
626+
clearInterval(blinkInterval);
623627
activity.textMsg(_("Error occurred"), 3000);
628+
submit.disabled = false;
624629
}
625630
};
626631

0 commit comments

Comments
 (0)