Skip to content

Commit 046f87d

Browse files
committed
rename session to conversation in params
1 parent 895b5ff commit 046f87d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import LayercodeClient from '@layercode/js-sdk';
66
*/
77
interface UseLayercodeAgentOptions {
88
agentId: string;
9-
sessionId?: string;
9+
conversationId?: string;
1010
authorizeSessionEndpoint: string;
1111
metadata?: Record<string, any>;
12-
onConnect?: ({ sessionId }: { sessionId: string | null }) => void;
12+
onConnect?: ({ conversationId }: { conversationId: string | null }) => void;
1313
onDisconnect?: () => void;
1414
onError?: (error: Error) => void;
1515
onDataMessage?: (data: any) => void;
@@ -26,7 +26,7 @@ const useLayercodeAgent = (
2626
options: UseLayercodeAgentOptions & Record<string, any>
2727
) => {
2828
// Extract public options
29-
const { agentId, sessionId, authorizeSessionEndpoint, metadata = {}, onConnect, onDisconnect, onError, onDataMessage } = options;
29+
const { agentId, conversationId, authorizeSessionEndpoint, metadata = {}, onConnect, onDisconnect, onError, onDataMessage } = options;
3030

3131
const [status, setStatus] = useState('initializing');
3232
const [userAudioAmplitude, setUserAudioAmplitude] = useState(0);
@@ -40,11 +40,11 @@ const useLayercodeAgent = (
4040
console.log('Creating LayercodeClient instance');
4141
clientRef.current = new LayercodeClient({
4242
agentId,
43-
sessionId,
43+
conversationId,
4444
authorizeSessionEndpoint,
4545
metadata,
46-
onConnect: ({ sessionId }: { sessionId: string | null }) => {
47-
onConnect?.({ sessionId });
46+
onConnect: ({ conversationId }: { conversationId: string | null }) => {
47+
onConnect?.({ conversationId });
4848
},
4949
onDisconnect: () => {
5050
onDisconnect?.();
@@ -84,7 +84,7 @@ const useLayercodeAgent = (
8484
}
8585
};
8686
// Add the internal override URL to the dependency array
87-
}, [agentId, sessionId, authorizeSessionEndpoint]); // Make sure metadata isn't causing unnecessary re-renders if it changes often
87+
}, [agentId, conversationId, authorizeSessionEndpoint]); // Make sure metadata isn't causing unnecessary re-renders if it changes often
8888

8989
// Class methods
9090
// TODO: Mic mute

0 commit comments

Comments
 (0)