@@ -4,13 +4,13 @@ import { Channel, Event } from 'stream-chat';
44
55import type { DefaultStreamChatGenerics } from '../../../types/types' ;
66
7- export enum AIStatesEnum {
8- Error = 'AI_STATE_ERROR' ,
9- ExternalSources = 'AI_STATE_EXTERNAL_SOURCES' ,
10- Generating = 'AI_STATE_GENERATING' ,
11- Idle = 'AI_STATE_IDLE' ,
12- Thinking = 'AI_STATE_THINKING' ,
13- }
7+ export type AIStateType =
8+ | 'AI_STATE_ERROR'
9+ | 'AI_STATE_EXTERNAL_SOURCES'
10+ | 'AI_STATE_GENERATING'
11+ | 'AI_STATE_IDLE'
12+ | 'AI_STATE_THINKING'
13+ | string ;
1414
1515export const AIStates = {
1616 Error : 'AI_STATE_ERROR' ,
@@ -25,7 +25,7 @@ export const useAIState = <
2525> (
2626 channel ?: Channel < StreamChatGenerics > ,
2727) => {
28- const [ aiState , setAiState ] = useState < AIStatesEnum > ( AIStatesEnum . Idle ) ;
28+ const [ aiState , setAiState ] = useState < AIStateType > ( AIStates . Idle ) ;
2929
3030 useEffect ( ( ) => {
3131 if ( ! channel ) {
@@ -36,7 +36,7 @@ export const useAIState = <
3636 'ai_indicator_changed' ,
3737 ( event : Event < StreamChatGenerics > ) => {
3838 const { cid } = event ;
39- const state = event . state as AIStatesEnum ;
39+ const state = event . state as AIStateType ;
4040 if ( channel . cid === cid ) {
4141 setAiState ( state ) ;
4242 }
@@ -46,7 +46,7 @@ export const useAIState = <
4646 const indicatorClearedListener = channel . on ( 'ai_indicator_clear' , ( event ) => {
4747 const { cid } = event ;
4848 if ( channel . cid === cid ) {
49- setAiState ( AIStatesEnum . Idle ) ;
49+ setAiState ( AIStates . Idle ) ;
5050 }
5151 } ) ;
5252
0 commit comments