Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/embed-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@humeai/voice-embed-react",
"version": "0.2.0-beta.1",
"version": "0.2.0-beta.2",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/embed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@humeai/voice-embed",
"version": "0.2.0-beta.1",
"version": "0.2.0-beta.2",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@humeai/voice-react",
"version": "0.2.0-beta.1",
"version": "0.2.0-beta.2",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
15 changes: 8 additions & 7 deletions packages/react/src/lib/useVoiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const useVoiceClient = (props: {
const sendSessionSettings = useCallback(
(sessionSettings: Hume.empathicVoice.SessionSettings) => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.sendSessionSettings(sessionSettings);
},
Expand All @@ -223,7 +223,7 @@ export const useVoiceClient = (props: {
const sendAudio = useCallback(
(arrayBuffer: ArrayBufferLike) => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.socket?.send(arrayBuffer);
},
Expand All @@ -233,7 +233,7 @@ export const useVoiceClient = (props: {
const sendUserInput = useCallback(
(text: string) => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.sendUserInput(text);
},
Expand All @@ -243,7 +243,7 @@ export const useVoiceClient = (props: {
const sendAssistantInput = useCallback(
(text: string) => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.sendAssistantInput({
text,
Expand All @@ -261,7 +261,7 @@ export const useVoiceClient = (props: {
| Hume.empathicVoice.ToolErrorMessage,
) => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
if (toolMessage.type === 'tool_error') {
client.current?.sendToolErrorMessage(toolMessage);
Expand All @@ -274,13 +274,14 @@ export const useVoiceClient = (props: {

const sendPauseAssistantMessage = useCallback(() => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.pauseAssistant({});
}, [readyState]);

const sendResumeAssistantMessage = useCallback(() => {
if (readyState !== VoiceReadyState.OPEN) {
throw new Error('Socket is not open');
return;
}
client.current?.resumeAssistant({});
}, [readyState]);
Expand Down