Skip to content

Commit 4273902

Browse files
committed
add sendClientResponseText method
1 parent 096a171 commit 4273902

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ const useLayercodeAgent = (
128128
const triggerUserTurnFinished = useCallback(() => {
129129
clientRef.current?.triggerUserTurnFinished();
130130
}, []);
131+
const sendClientResponseText = useCallback((text: string) => {
132+
clientRef.current?.sendClientResponseText(text);
133+
}, []);
131134
const connect = useCallback(async () => {
132135
if (clientRef.current) {
133136
try {
@@ -138,10 +141,7 @@ const useLayercodeAgent = (
138141
clientRef.current = null;
139142
}
140143

141-
const nextConversationId =
142-
conversationIdRef.current !== undefined
143-
? conversationIdRef.current
144-
: internalConversationId ?? null;
144+
const nextConversationId = conversationIdRef.current !== undefined ? conversationIdRef.current : internalConversationId ?? null;
145145

146146
const client = createClient(nextConversationId ?? null);
147147

@@ -179,6 +179,7 @@ const useLayercodeAgent = (
179179
disconnect,
180180
mute,
181181
unmute,
182+
sendClientResponseText,
182183

183184
// State
184185
status,

0 commit comments

Comments
 (0)