Add use_vad flag to VA start request (#438)

This commit is contained in:
Jesse Hills 2023-05-30 14:17:55 +12:00 committed by GitHub
parent dc7d13f64a
commit 8340d2a6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 56 deletions

View File

@ -1424,6 +1424,7 @@ message VoiceAssistantRequest {
bool start = 1;
string conversation_id = 2;
bool use_vad = 3;
}
message VoiceAssistantResponse {

File diff suppressed because one or more lines are too long

View File

@ -1266,7 +1266,7 @@ class APIClient:
async def subscribe_voice_assistant(
self,
handle_start: Callable[[str], Coroutine[Any, Any, Optional[int]]],
handle_start: Callable[[str, bool], Coroutine[Any, Any, Optional[int]]],
handle_stop: Callable[[], Coroutine[Any, Any, None]],
) -> Callable[[], None]:
"""Subscribes to voice assistant messages from the device.
@ -1294,7 +1294,9 @@ class APIClient:
def on_msg(msg: VoiceAssistantRequest) -> None:
command = VoiceAssistantCommand.from_pb(msg)
if command.start:
start_task = asyncio.create_task(handle_start(command.conversation_id))
start_task = asyncio.create_task(
handle_start(command.conversation_id, command.use_vad)
)
start_task.add_done_callback(_started)
# We hold a reference to the start_task in unsub function
# so we don't need to add it to the background tasks.

View File

@ -990,6 +990,7 @@ class BluetoothDeviceRequestType(APIIntEnum):
class VoiceAssistantCommand(APIModelBase):
start: bool = False
conversation_id: str = ""
use_vad: bool = False
class LogLevel(APIIntEnum):