ChatKitEvents
type ChatKitEvents = { chatkit.error: CustomEvent<{ error: Error; }>; chatkit.log: CustomEvent<{ data?: Record<string, unknown>; name: string; }>; chatkit.response.end: CustomEvent<void>; chatkit.response.start: CustomEvent<void>; chatkit.thread.change: CustomEvent<{ threadId: string | null; }>; chatkit.thread.load.end: CustomEvent<{ threadId: string; }>; chatkit.thread.load.start: CustomEvent<{ threadId: string; }>;};
DOM events emitted by the openai-chatkit
custom element.
Properties
Section titled “Properties”chatkit.error
Section titled “chatkit.error”chatkit.error: CustomEvent<{ error: Error;}>;
Emitted when an error occurs. You should log these for monitoring and debugging.
chatkit.log
Section titled “chatkit.log”chatkit.log: CustomEvent<{ data?: Record<string, unknown>; name: string;}>;
Diagnostic events that can be used for logging/analytics.
chatkit.response.end
Section titled “chatkit.response.end”chatkit.response.end: CustomEvent<void>;
Emitted when the assistant finishes sending a response.
chatkit.response.start
Section titled “chatkit.response.start”chatkit.response.start: CustomEvent<void>;
Emitted when the assistant begins sending a response.
chatkit.thread.change
Section titled “chatkit.thread.change”chatkit.thread.change: CustomEvent<{ threadId: string | null;}>;
Emitted when the active thread changes. Use this along with initialThread
to persist the current thread across page loads or sessions.
chatkit.thread.load.end
Section titled “chatkit.thread.load.end”chatkit.thread.load.end: CustomEvent<{ threadId: string;}>;
Emitted when ChatKit finished loading a thread.
chatkit.thread.load.start
Section titled “chatkit.thread.load.start”chatkit.thread.load.start: CustomEvent<{ threadId: string;}>;
Emitted when ChatKit starts loading a thread (initial load or selected from history).