From 84c7854228106e280947a14f747e30eb5977dca0 Mon Sep 17 00:00:00 2001 From: Ivan Sekovanikj Date: Tue, 3 Dec 2024 12:40:00 +0100 Subject: [PATCH] chore: update event names as per the changes --- .../components/AITypingIndicatorView/hooks/useAIState.ts | 6 +++--- package/src/components/MessageInput/MessageInput.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/src/components/AITypingIndicatorView/hooks/useAIState.ts b/package/src/components/AITypingIndicatorView/hooks/useAIState.ts index 9e7edcac5..6cdb24b90 100644 --- a/package/src/components/AITypingIndicatorView/hooks/useAIState.ts +++ b/package/src/components/AITypingIndicatorView/hooks/useAIState.ts @@ -33,17 +33,17 @@ export const useAIState = < } const indicatorChangedListener = channel.on( - 'ai_indicator_changed', + 'ai_indicator.update', (event: Event) => { const { cid } = event; - const state = event.state as AIStateType; + const state = event.ai_state as AIStateType; if (channel.cid === cid) { setAiState(state); } }, ); - const indicatorClearedListener = channel.on('ai_indicator_clear', (event) => { + const indicatorClearedListener = channel.on('ai_indicator.clear', (event) => { const { cid } = event; if (channel.cid === cid) { setAiState(AIStates.Idle); diff --git a/package/src/components/MessageInput/MessageInput.tsx b/package/src/components/MessageInput/MessageInput.tsx index 807dfc1fa..cd7f2de54 100644 --- a/package/src/components/MessageInput/MessageInput.tsx +++ b/package/src/components/MessageInput/MessageInput.tsx @@ -734,7 +734,7 @@ const MessageInputWithContext = < const { aiState } = useAIState(channel); const stopGenerating = useCallback( - () => channel.sendEvent({ type: 'stop_generating' }), + () => channel.sendEvent({ type: 'ai_indicator.stop' }), [channel], ); const shouldDisplayStopAIGeneration = [AIStates.Thinking, AIStates.Generating].includes(aiState);