stream-chat
Advanced tools
Comparing version 8.45.3 to 8.46.0
/// <reference types="node" /> | ||
import { ChannelState } from './channel_state'; | ||
import { StreamChat } from './client'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc, PartialUpdateMemberAPIResponse } from './types'; | ||
import { APIResponse, BanUserOptions, ChannelAPIResponse, ChannelData, ChannelMemberAPIResponse, ChannelMemberResponse, ChannelQueryOptions, ChannelResponse, ChannelUpdateOptions, CreateCallOptions, CreateCallResponse, DefaultGenerics, DeleteChannelAPIResponse, Event, EventAPIResponse, EventHandler, EventTypes, ExtendableGenerics, FormatMessageResponse, GetMultipleMessagesAPIResponse, GetReactionsAPIResponse, GetRepliesAPIResponse, InviteOptions, MarkReadOptions, MarkUnreadOptions, MemberFilters, MemberSort, Message, MessageFilters, MessagePaginationOptions, MessageResponse, MessageSetType, MuteChannelAPIResponse, NewMemberPayload, PartialUpdateChannel, PartialUpdateChannelAPIResponse, PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, Reaction, ReactionAPIResponse, SearchAPIResponse, SearchOptions, SendMessageAPIResponse, TruncateChannelAPIResponse, TruncateOptions, UpdateChannelAPIResponse, UserResponse, QueryChannelAPIResponse, PollVoteData, SendMessageOptions, AscDesc, PartialUpdateMemberAPIResponse, AIState } from './types'; | ||
import { Role } from './permissions'; | ||
@@ -379,2 +379,23 @@ /** | ||
/** | ||
* Sends an event to update the AI state for a specific message. | ||
* Typically used by the server connected to the AI service to notify clients of state changes. | ||
* | ||
* @param messageId - The ID of the message associated with the AI state. | ||
* @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. | ||
*/ | ||
updateAIState(messageId: string, state: AIState, options?: { | ||
ai_message?: string; | ||
}): Promise<void>; | ||
/** | ||
* Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming. | ||
* Typically used by the server connected to the AI service to inform clients that the AI response has started. | ||
*/ | ||
clearAIIndicator(): Promise<void>; | ||
/** | ||
* Sends an event to stop AI response generation, leaving the message in its current state. | ||
* Triggered by the user to halt the AI response process. | ||
*/ | ||
stopAIResponse(): Promise<void>; | ||
/** | ||
* stopTyping - Sets last typing to null and sends the typing.stop event | ||
@@ -381,0 +402,0 @@ * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs} |
@@ -51,2 +51,5 @@ export declare const EVENT_MAP: { | ||
'user.watching.stop': boolean; | ||
'ai_indicator.update': boolean; | ||
'ai_indicator.stop': boolean; | ||
'ai_indicator.clear': boolean; | ||
'channels.queried': boolean; | ||
@@ -53,0 +56,0 @@ 'connection.changed': boolean; |
{ | ||
"name": "stream-chat", | ||
"version": "8.45.3", | ||
"version": "8.46.0", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -62,2 +62,3 @@ import { ChannelState } from './channel_state'; | ||
PartialUpdateMemberAPIResponse, | ||
AIState, | ||
} from './types'; | ||
@@ -792,2 +793,39 @@ import { Role } from './permissions'; | ||
/** | ||
* Sends an event to update the AI state for a specific message. | ||
* Typically used by the server connected to the AI service to notify clients of state changes. | ||
* | ||
* @param messageId - The ID of the message associated with the AI state. | ||
* @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 } = {}) { | ||
await this.sendEvent({ | ||
...options, | ||
type: 'ai_indicator.update', | ||
message_id: messageId, | ||
ai_state: state, | ||
} as Event<StreamChatGenerics>); | ||
} | ||
/** | ||
* Sends an event to notify watchers to clear the typing/thinking UI when the AI response starts streaming. | ||
* Typically used by the server connected to the AI service to inform clients that the AI response has started. | ||
*/ | ||
async clearAIIndicator() { | ||
await this.sendEvent({ | ||
type: 'ai_indicator.clear', | ||
} as Event<StreamChatGenerics>); | ||
} | ||
/** | ||
* Sends an event to stop AI response generation, leaving the message in its current state. | ||
* Triggered by the user to halt the AI response process. | ||
*/ | ||
async stopAIResponse() { | ||
await this.sendEvent({ | ||
type: 'ai_indicator.stop', | ||
} as Event<StreamChatGenerics>); | ||
} | ||
/** | ||
* stopTyping - Sets last typing to null and sends the typing.stop event | ||
@@ -794,0 +832,0 @@ * @see {@link https://getstream.io/chat/docs/typing_indicators/?language=js|Docs} |
@@ -51,2 +51,6 @@ export const EVENT_MAP = { | ||
'user.watching.stop': true, | ||
// AI events | ||
'ai_indicator.update': true, | ||
'ai_indicator.stop': true, | ||
'ai_indicator.clear': true, | ||
@@ -53,0 +57,0 @@ // local events |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
7418468
77352
9
65