Add conversation_id to VA start request (#437)

This commit is contained in:
Jesse Hills 2023-05-30 11:18:28 +12:00 committed by GitHub
parent 8a661bb673
commit b1bfabacc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 56 deletions

View File

@ -1423,6 +1423,7 @@ message VoiceAssistantRequest {
option (ifdef) = "USE_VOICE_ASSISTANT"; option (ifdef) = "USE_VOICE_ASSISTANT";
bool start = 1; bool start = 1;
string conversation_id = 2;
} }
message VoiceAssistantResponse { 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( async def subscribe_voice_assistant(
self, self,
handle_start: Callable[[], Coroutine[Any, Any, Optional[int]]], handle_start: Callable[[str], Coroutine[Any, Any, Optional[int]]],
handle_stop: Callable[[], Coroutine[Any, Any, None]], handle_stop: Callable[[], Coroutine[Any, Any, None]],
) -> Callable[[], None]: ) -> Callable[[], None]:
"""Subscribes to voice assistant messages from the device. """Subscribes to voice assistant messages from the device.
@ -1294,7 +1294,7 @@ class APIClient:
def on_msg(msg: VoiceAssistantRequest) -> None: def on_msg(msg: VoiceAssistantRequest) -> None:
command = VoiceAssistantCommand.from_pb(msg) command = VoiceAssistantCommand.from_pb(msg)
if command.start: if command.start:
start_task = asyncio.create_task(handle_start()) start_task = asyncio.create_task(handle_start(command.conversation_id))
start_task.add_done_callback(_started) start_task.add_done_callback(_started)
# We hold a reference to the start_task in unsub function # We hold a reference to the start_task in unsub function
# so we don't need to add it to the background tasks. # so we don't need to add it to the background tasks.

View File

@ -989,6 +989,7 @@ class BluetoothDeviceRequestType(APIIntEnum):
@dataclass(frozen=True) @dataclass(frozen=True)
class VoiceAssistantCommand(APIModelBase): class VoiceAssistantCommand(APIModelBase):
start: bool = False start: bool = False
conversation_id: str = ""
class LogLevel(APIIntEnum): class LogLevel(APIIntEnum):