Skip to content

Commit 6dff4b1

Browse files
authored
Merge pull request #110 from openai/add-client-side-effect-handler
client effect event
2 parents 08da5c1 + c89c679 commit 6dff4b1

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/chatkit-react/src/ChatKit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const EVENT_HANDLER_MAP: {
2828
'chatkit.thread.load.start': 'onThreadLoadStart',
2929
'chatkit.thread.load.end': 'onThreadLoadEnd',
3030
'chatkit.ready': 'onReady',
31+
'chatkit.effect': 'onEffect',
3132
};
3233

3334
const EVENT_NAMES = Object.keys(EVENT_HANDLER_MAP) as (keyof ChatKitEvents)[];

packages/chatkit/types/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,12 @@ export type ChatKitEvents = {
928928
/** Emitted when an error occurs. You should log these for monitoring and debugging. */
929929
'chatkit.error': CustomEvent<{ error: Error }>;
930930

931+
/** Emitted when a fire-and-forget client effect is triggered. */
932+
'chatkit.effect': CustomEvent<{
933+
name: string;
934+
data?: Record<string, unknown>;
935+
}>;
936+
931937
/** Emitted when the assistant begins sending a response. */
932938
'chatkit.response.start': CustomEvent<void>;
933939

0 commit comments

Comments
 (0)