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 26947cf commit 84c7854
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ export const useAIState = <
}

const indicatorChangedListener = channel.on(
'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);
}
},
);

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
2 changes: 1 addition & 1 deletion package/src/components/MessageInput/MessageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84c7854

Please sign in to comment.