-
Notifications
You must be signed in to change notification settings - Fork 187
_waitForGeneration hangs when speech task is canceled before play out #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
|
Could you record a video that can reproduce this bug in playground? |
eb7c21b to
5015f41
Compare
|
I've added a test for AgentActivity, just check out this branch and |
|
Instead of throwing, I'm using a Promise.race with the cancel promise. Looks better to me ;-) |
agents/src/voice/agent_activity.ts
Outdated
| try { | ||
| await Promise.race([ | ||
| speechHandle._waitForGeneration(), | ||
| new Promise((_, reject) => setTimeout(() => reject('timeout after 30 seconds'), 30000)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would happen if the actual speech is longer than 30 seconds? e.g. User asks tell me a very long story to agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolut good point, for our use case 30 seconds is enough, but there are ppbl cases where this is not the case. As this was mainly for testing and debugging I would say we can skip this for now. The main issue was in the cancelation of the speech before it was played out, and this is solved with the promise.race inside the speech_handle.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An idea for the future: allow setting a timeout, but make it configurable, and disable it by default.
8cba2d6 to
40640b7
Compare
Description
fix for #836
open for further investigation or discussion