Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Arnautov <[email protected]>
  • Loading branch information
kanat and arnautov-anton authored Nov 27, 2024
1 parent 7c8952a commit db9fad7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,12 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
* @param state - The new state of the AI process (e.g., thinking, generating).
* @param options - Optional parameters, such as `ai_message`, to include additional details in the event.
*/
async updateAIState(messageId: string, state: AIState, options?: { ai_message: string }) {
async updateAIState(messageId: string, state: AIState, options: { ai_message: string } = {}) {

Check failure on line 799 in src/channel.ts

View workflow job for this annotation

GitHub Actions / lint

Property 'ai_message' is missing in type '{}' but required in type '{ ai_message: string; }'.

Check failure on line 799 in src/channel.ts

View workflow job for this annotation

GitHub Actions / test (18)

Property 'ai_message' is missing in type '{}' but required in type '{ ai_message: string; }'.
await this.sendEvent({

Check failure on line 800 in src/channel.ts

View workflow job for this annotation

GitHub Actions / lint

Conversion of type '{ type: "ai_indicator.update"; message_id: string; ai_state: AIState; ai_message: string; }' to type 'Event<StreamChatGenerics>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

Check failure on line 800 in src/channel.ts

View workflow job for this annotation

GitHub Actions / test (18)

Conversion of type '{ type: "ai_indicator.update"; message_id: string; ai_state: AIState; ai_message: string; }' to type 'Event<StreamChatGenerics>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
...options,
type: 'ai_indicator.update',
message_id: messageId,
ai_state: state,
...(options || {}),
} as Event<StreamChatGenerics>);
}

Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3547,4 +3547,4 @@ export type GetUserModerationReportOptions = {
include_user_mutes?: boolean;
};

export type AIState = 'AI_STATE_ERROR|AI_STATE_CHECKING_SOURCES|AI_STATE_THINKING|AI_STATE_GENERATING' | string;
export type AIState = 'AI_STATE_ERROR' | 'AI_STATE_CHECKING_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | (string & {});

0 comments on commit db9fad7

Please sign in to comment.