Skip to content

Commit 85548d6

Browse files
committed
feat: rename pipeline to agent
1 parent f0143a3 commit 85548d6

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Layercode React SDK
22

3-
A React SDK for integrating Layercode audio pipelines into React applications.
3+
A React SDK for integrating Layercode audio agents into React applications.
44

55
## Installation
66

src/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { useState, useEffect, useCallback, useRef } from 'react';
22
import LayercodeClient from '@layercode/js-sdk';
33

44
/**
5-
* Configuration options for the useLayercodePipeline hook.
5+
* Configuration options for the useLayercodeAgent hook.
66
*/
7-
interface UseLayercodePipelineOptions {
8-
pipelineId: string;
7+
interface UseLayercodeAgentOptions {
8+
agentId: string;
99
sessionId?: string;
1010
authorizeSessionEndpoint: string;
1111
metadata?: Record<string, any>;
@@ -16,17 +16,17 @@ interface UseLayercodePipelineOptions {
1616
}
1717

1818
/**
19-
* Hook for connecting to a Layercode pipeline in a React application
19+
* Hook for connecting to a Layercode agent in a React application
2020
*
21-
* @param options - Configuration options for the pipeline
22-
* @returns An object containing methods and state for interacting with the pipeline
21+
* @param options - Configuration options for the agent
22+
* @returns An object containing methods and state for interacting with the agent
2323
*/
24-
const useLayercodePipeline = (
24+
const useLayercodeAgent = (
2525
// Accept the public options plus any other properties (for internal use)
26-
options: UseLayercodePipelineOptions & Record<string, any>
26+
options: UseLayercodeAgentOptions & Record<string, any>
2727
) => {
2828
// Extract public options
29-
const { pipelineId, sessionId, authorizeSessionEndpoint, metadata = {}, onConnect, onDisconnect, onError, onDataMessage } = options;
29+
const { agentId, sessionId, authorizeSessionEndpoint, metadata = {}, onConnect, onDisconnect, onError, onDataMessage } = options;
3030

3131
const [status, setStatus] = useState('initializing');
3232
const [userAudioAmplitude, setUserAudioAmplitude] = useState(0);
@@ -39,7 +39,7 @@ const useLayercodePipeline = (
3939
// Create a new LayercodeClient instance
4040
console.log('Creating LayercodeClient instance');
4141
clientRef.current = new LayercodeClient({
42-
pipelineId,
42+
agentId,
4343
sessionId,
4444
authorizeSessionEndpoint,
4545
metadata,
@@ -71,9 +71,9 @@ const useLayercodePipeline = (
7171
clientRef.current._websocketUrl = options['_websocketUrl'];
7272
}
7373

74-
// Connect to the pipeline
74+
// Connect to the agent
7575
clientRef.current.connect().catch((error: Error) => {
76-
console.error('Failed to connect to pipeline:', error);
76+
console.error('Failed to connect to agent:', error);
7777
onError?.(error);
7878
});
7979

@@ -84,7 +84,7 @@ const useLayercodePipeline = (
8484
}
8585
};
8686
// Add the internal override URL to the dependency array
87-
}, [pipelineId, sessionId, authorizeSessionEndpoint]); // Make sure metadata isn't causing unnecessary re-renders if it changes often
87+
}, [agentId, sessionId, authorizeSessionEndpoint]); // Make sure metadata isn't causing unnecessary re-renders if it changes often
8888

8989
// Class methods
9090
// TODO: Mic mute
@@ -119,4 +119,4 @@ const useLayercodePipeline = (
119119
};
120120
};
121121

122-
export { useLayercodePipeline, UseLayercodePipelineOptions }; // Export the type too
122+
export { useLayercodeAgent, UseLayercodeAgentOptions }; // Export the type too

0 commit comments

Comments
 (0)