fixed gather cannot timeout if listenDuringPrompt is true (#1276)

* fixed gather cannot timeout if listenDuringPrompt is true

* wip

* wip

* wip
This commit is contained in:
Hoan Luu Huu
2025-07-16 09:53:22 +07:00
committed by GitHub
parent ee895b4046
commit e0e2ade289
2 changed files with 14 additions and 4 deletions

View File

@@ -267,11 +267,16 @@ class TaskGather extends SttTask {
.catch((err) => {
process();
});
this.sayTask.on('playDone', (err) => {
span.end();
if (err) this.logger.error({err}, 'Gather:exec Error playing tts');
if (this.sayTask.isStreamingTts && !this.sayTask.closeOnStreamEmpty) {
// if streaming tts, we do not wait for it to complete if it is not closing the stream automatically
process();
});
} else {
this.sayTask.on('playDone', (err) => {
span.end();
if (err) this.logger.error({err}, 'Gather:exec Error playing tts');
process();
});
}
}
else if (this.playTask) {
const {span, ctx} = this.startChildSpan(`nested:${this.playTask.summary}`);