UNPKG

@n8n-plus/n8n-plus

Version:

n8n Workflow Automation Tool (plus edition)

19 lines (18 loc) 1.05 kB
import type { ChatMessageId } from '@n8n/api-types'; import type { Response } from 'express'; import type { StructuredChunk } from 'n8n-workflow'; import type { ChatHubMessage } from './chat-hub-message.entity'; export type ChunkTransformer = (chunk: string) => void; export declare function interceptResponseWrites<T extends Response>(res: T, transform: ChunkTransformer): T; export type AggregatedMessage = Pick<ChatHubMessage, 'id' | 'previousMessageId' | 'retryOfMessageId' | 'content' | 'createdAt' | 'updatedAt' | 'status'>; type Handlers = { onBegin?: (message: AggregatedMessage) => void; onItem?: (message: AggregatedMessage, delta: string) => void; onEnd?: (message: AggregatedMessage) => void; onError?: (message: AggregatedMessage, errText?: string) => void; }; export declare function createStructuredChunkAggregator(initialPreviousMessageId: ChatMessageId, retryOfMessageId: ChatMessageId | null, handlers?: Handlers): { ingest: (chunk: StructuredChunk) => AggregatedMessage; finalizeAll: () => void; }; export {};