Skip to content

Commit

Permalink
chore: update event names as per the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
isekovanic committed Dec 3, 2024
1 parent 0722e98 commit 01139bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/components/AITypingIndicatorView/hooks/useAIState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,18 @@ export const useAIState = <
}

const indicatorChangedListener = channel.on(
// @ts-ignore
'ai_indicator_changed',
'ai_indicator.update',
(event: Event<StreamChatGenerics>) => {
const { cid } = event;
const state = event.state as AIStateType;
const state = event.ai_state as AIStateType;
if (channel.cid === cid) {
setAiState(state);
}
},
);

// @ts-ignore
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);
Expand Down
3 changes: 1 addition & 2 deletions src/components/MessageInput/MessageInputFlat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export const MessageInputFlat = <

const { aiState } = useAIState(channel);

// @ts-ignore
const stopGenerating = useCallback(() => channel?.sendEvent({ type: 'stop_generating' }), [
const stopGenerating = useCallback(() => channel?.sendEvent({ type: 'ai_indicator.stop' }), [
channel,
]);

Expand Down

0 comments on commit 01139bc

Please sign in to comment.