claudius-chat-widget
    Preparing search index...

    Interface BeforeSendContext

    Context for ClaudiusPlugin.onBeforeSend. Adds the ability to short-circuit the request before it reaches the network.

    interface BeforeSendContext {
        apiUrl: string;
        messages: readonly ChatMessage[];
        abort(reason?: string): void;
        respondWith(reply: string | PluginReply): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Methods

    Properties

    apiUrl: string

    The Worker chat endpoint URL the widget posts to.

    messages: readonly ChatMessage[]

    Conversation snapshot, oldest message first. Treat as immutable.

    Methods

    • Cancel the send entirely: no request is made and nothing is rendered (the user message is dropped). Stops the hook chain. Use for client-only commands the chat should swallow.

      Parameters

      • Optionalreason: string

      Returns void

    • Skip the network request and render this assistant reply instead. The (possibly modified) user message is still shown. Stops the hook chain — later plugins' onBeforeSend hooks do not run.

      Parameters

      Returns void