@dypai-ai/client-sdk - v1.12.0
    Preparing search index...

    Interface UseChatOptions

    Options for the useChat hook

    interface UseChatOptions {
        body?: Record<string, any>;
        headers?: Record<string, string>;
        id?: string;
        initialMessages?: ChatMessage[];
        loadHistory?: boolean;
        onError?: (error: DypaiError | Error) => void;
        onFinish?: (message: ChatMessage, allMessages: ChatMessage[]) => void;
        onToolCall?: (toolCall: { args: any; toolName: string }) => void;
    }
    Index

    Properties

    body?: Record<string, any>

    Extra body fields sent with every message

    headers?: Record<string, string>

    Extra headers sent with every request

    id?: string

    Chat/session ID. Auto-generated if not provided. Persisted in localStorage if persistSession is true.

    initialMessages?: ChatMessage[]

    Initial messages to display before loading from server

    loadHistory?: boolean

    Load chat history from server on mount (default: true)

    onError?: (error: DypaiError | Error) => void

    Called on error

    onFinish?: (message: ChatMessage, allMessages: ChatMessage[]) => void

    Called when the assistant finishes responding

    onToolCall?: (toolCall: { args: any; toolName: string }) => void

    Called when a tool call is received (for client-side tool rendering)