claudius-chat-widget
    Preparing search index...

    Interface ChatStreamOptions

    interface ChatStreamOptions {
        onChunk?: (text: string, fullText: string) => void;
        onSources?: (sources: Source[]) => void;
        onToolUse?: (toolUse: ToolUse, allToolUses: ToolUse[]) => void;
        signal?: AbortSignal;
    }
    Index

    Properties

    onChunk?: (text: string, fullText: string) => void

    Called once per streamed text delta, as tokens arrive.

    Type Declaration

      • (text: string, fullText: string): void
      • Parameters

        • text: string

          The incremental text of this chunk.

        • fullText: string

          The full reply accumulated so far, including this chunk.

        Returns void

    onSources?: (sources: Source[]) => void

    Called when the worker announces the reply's sources ahead of the text, so citation chips can render while the reply streams. The done event carries the final list.

    onToolUse?: (toolUse: ToolUse, allToolUses: ToolUse[]) => void

    Called when the assistant finishes a tool call mid-stream, so the UI can show a "used tool" affordance before the reply completes.

    signal?: AbortSignal

    Cancels the stream when aborted. Cancellation is not an error: the promise resolves with the partial reply and aborted: true.