/** * Message API Service * Handles message creation and AI response generation */ export interface CreateMessageRequest { content: string; } export interface MessageResponse { uuid: string; conversation_uuid: string; type: 'user' | 'assistant'; content: string; created_at: string; } export interface GenerateMessageResponse { uuid: string; parent_message_uuid: string; type: 'assistant'; content: string; status: 'completed' | 'pending' | 'error'; created_at: string; } export interface StreamChunkEvent { type: 'chunk'; content: string; done?: boolean; sources?: Array<{ document_uuid: string; document_title: string; chunk_indices: number[]; }>; validation?: { confidence: number; valid: boolean; status: string; }; } export interface StreamCompletionEvent { type: 'completion'; uuid: string; parent_message_uuid: string; status: 'completed'; created_at: string; } export interface StreamErrorEvent { type: 'error'; error: string; message: string; } export type StreamEvent = StreamChunkEvent | StreamCompletionEvent | StreamErrorEvent; export interface StreamCallbacks { onChunk?: (content: string, isDone?: boolean, sources?: Array<{ document_uuid: string; document_title: string; chunk_indices: number[]; }>, validation?: { confidence: number; valid: boolean; status: string; }) => void; onCompletion?: (data: StreamCompletionEvent) => void; onError?: (error: StreamErrorEvent) => void; onDone?: () => void; } /** * Create a user message in a conversation */ export declare function createUserMessage(conversationUuid: string, request: CreateMessageRequest, apiUrl?: string): Promise; /** * Generate AI response for a user message (legacy - returns full response) * @deprecated Use streamAIResponse for better performance */ export declare function generateAIResponse(userMessageUuid: string, apiUrl?: string): Promise; /** * Stream AI response using Server-Sent Events (SSE) * This is the recommended approach for real-time streaming */ export declare function streamAIResponse(userMessageUuid: string, callbacks: StreamCallbacks, apiUrl?: string, userContext?: Record): Promise; /** * Feedback API */ export interface SubmitFeedbackRequest { message_uuid: string; rating: 'positive' | 'negative'; category?: string; comment?: string; suggested_improvement?: string; } export interface SubmitFeedbackResponse { success: boolean; feedback: { uuid: string; message_uuid: string; rating: 'positive' | 'negative'; category?: string; comment?: string; suggested_improvement?: string; created_at: string; }; } export interface DeleteFeedbackResponse { success: boolean; message: string; } /** * Submit feedback for a message (create or update) - Public API */ export declare function submitFeedback(request: SubmitFeedbackRequest, apiUrl?: string): Promise; /** * Delete/undo feedback for a message - Public API */ export declare function deleteFeedback(feedbackUuid: string, apiUrl?: string): Promise;