UNPKG

@agentman/chat-widget

Version:

Agentman Chat Widget for easy integration with web applications

46 lines (45 loc) 1.16 kB
import type { Message } from '../types/types'; export interface StreamingCallbacks { onMessage?: (message: Message) => void; onChunk?: (chunk: string, messageId: string) => void; onError?: (error: Error) => void; onComplete?: () => void; } export interface StreamingConfig { apiUrl: string; debug?: boolean; } /** * Dedicated client for handling streaming responses * Separates streaming logic from main ApiService */ export declare class StreamingClient { private logger; private apiUrl; private config; private currentStream; constructor(config: StreamingConfig); /** * Send a streaming message request */ sendMessage(params: { agentToken: string; conversationId: string; userInput: string; attachmentFileIds?: string[]; attachmentUrls?: string[]; debug?: boolean; }, callbacks: StreamingCallbacks): Promise<void>; /** * Process the SSE stream */ private processStream; /** * Abort the current stream */ abort(): void; /** * Check if currently streaming */ isStreaming(): boolean; }