UNPKG

admesh-ui-sdk

Version:

Beautiful, modern React components for displaying AI-powered product recommendations with citation-based conversation ads, auto-triggered widgets, floating chat, conversational interfaces, persistent sidebar, and built-in tracking. Includes zero-code SDK

68 lines 2.62 kB
/** * Streaming Events Utilities * * Custom event system for communicating LLM streaming lifecycle events * between the chat frontend and AdMesh WeaveAdFormatContainer. * * This allows WeaveAdFormatContainer to trigger final link detection * when streaming completes, rather than using arbitrary timeouts. */ export declare const STREAMING_START_EVENT = "admesh:streamingStart"; export declare const STREAMING_COMPLETE_EVENT = "admesh:streamingComplete"; export interface StreamingStartEventDetail { messageId: string; sessionId: string; timestamp: number; } export interface StreamingCompleteEventDetail { messageId: string; sessionId: string; timestamp: number; metadata?: { hasRecommendations?: boolean; recommendationCount?: number; }; } /** * Dispatch a streaming start event * * Call this when the backend starts streaming the LLM response. * This signals to WeaveAdFormatContainer that content is being received. * * @param messageId - Unique identifier for the message * @param sessionId - Session/chat identifier */ export declare function dispatchStreamingStartEvent(messageId: string, sessionId: string): void; /** * Dispatch a streaming complete event * * Call this when the backend finishes streaming the LLM response. * This triggers WeaveAdFormatContainer to perform final link detection. * * @param messageId - Unique identifier for the message * @param sessionId - Session/chat identifier * @param metadata - Optional metadata about recommendations */ export declare function dispatchStreamingCompleteEvent(messageId: string, sessionId: string, metadata?: { hasRecommendations?: boolean; recommendationCount?: number; }): void; /** * Listen for streaming start events * * @param messageId - Filter events by this messageId * @param sessionId - Filter events by this sessionId * @param callback - Called when matching event is received * @returns Cleanup function to remove the event listener */ export declare function onStreamingStart(messageId: string, sessionId: string, callback: (detail: StreamingStartEventDetail) => void): () => void; /** * Listen for streaming complete events * * @param messageId - Filter events by this messageId * @param sessionId - Filter events by this sessionId * @param callback - Called when matching event is received * @returns Cleanup function to remove the event listener */ export declare function onStreamingComplete(messageId: string, sessionId: string, callback: (detail: StreamingCompleteEventDetail) => void): () => void; //# sourceMappingURL=streamingEvents.d.ts.map