Skip to content

Commit

Permalink
Update voice assistant state attribute (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasIO authored Aug 28, 2024
1 parent 68cf9a8 commit 8318a5d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/react/src/hooks/useVoiceAssistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export interface VoiceAssistant {
agentAttributes: RemoteParticipant['attributes'] | undefined;
}

const state_attribute = 'voice_assistant.state';

/**
* @alpha
*
Expand All @@ -50,11 +52,11 @@ export function useVoiceAssistant(): VoiceAssistant {
} else if (
connectionState === ConnectionState.Connecting ||
!agent ||
!attributes?.['agent.state']
!attributes?.[state_attribute]
) {
return 'connecting';
} else {
return attributes['agent.state'] as VoiceAssistantState;
return attributes[state_attribute] as VoiceAssistantState;
}
}, [attributes, agent, connectionState]);

Expand Down

0 comments on commit 8318a5d

Please sign in to comment.