Skip to content

Commit

Permalink
(fix): hostname is optional (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi authored Jul 22, 2024
1 parent 9847432 commit 662779b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
7 changes: 2 additions & 5 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { type Hume } from 'hume';

export * from './lib/connection-message';
export * from './lib/useMicrophone';
export * from './lib/useSoundPlayer';
Expand All @@ -14,9 +12,6 @@ export {
type TimeSlice,
} from './types';

export type SocketConfig = Hume.empathicVoice.chat.Chat.ConnectArgs &
Hume.empathicVoice.chat.Chat.Options;

export type {
AssistantEnd as AssistantEndMessage,
AssistantMessage as AssistantTranscriptMessage,
Expand All @@ -32,6 +27,8 @@ export type {
UserMessage as UserTranscriptMessage,
} from 'hume/api/resources/empathicVoice';

export type { SocketConfig } from './lib/useVoiceClient';

export type {
AssistantEnd,
AssistantMessage,
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/lib/VoiceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useMicrophone } from './useMicrophone';
import { useSoundPlayer } from './useSoundPlayer';
import { useToolStatus } from './useToolStatus';
import {
SockeConfig,
SocketConfig,
ToolCallHandler,
useVoiceClient,
type VoiceReadyState,
Expand Down Expand Up @@ -84,7 +84,7 @@ export type VoiceContextType = {

const VoiceContext = createContext<VoiceContextType | null>(null);

export type VoiceProviderProps = PropsWithChildren<SockeConfig> & {
export type VoiceProviderProps = PropsWithChildren<SocketConfig> & {
sessionSettings?: Hume.empathicVoice.SessionSettings;
onMessage?: (message: Hume.empathicVoice.SubscribeEvent) => void;
onError?: (err: VoiceError) => void;
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/lib/useVoiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useCallback, useRef, useState } from 'react';

import { type AuthStrategy } from './auth';

export type SockeConfig = {
export type SocketConfig = {
auth: AuthStrategy;
hostname: string;
hostname?: string;
} & Hume.empathicVoice.chat.Chat.ConnectArgs;

export enum VoiceReadyState {
Expand Down Expand Up @@ -69,7 +69,7 @@ export const useVoiceClient = (props: {
const onClose = useRef<typeof props.onClose>(props.onClose);
onClose.current = props.onClose;

const connect = useCallback((config: SockeConfig) => {
const connect = useCallback((config: SocketConfig) => {
return new Promise((resolve, reject) => {
const hume = new HumeClient(
config.auth.type === 'apiKey'
Expand Down

0 comments on commit 662779b

Please sign in to comment.