MAIDR JavaScript API
    Preparing search index...

    Class ChatService

    Service for managing chat interactions with different LLM providers.

    Index

    Constructors

    Methods

    • Sends a message to the specified LLM model and returns the response.

      Parameters

      • model: Llm

        The LLM provider to use

      • request: LlmRequest

        The request containing the message and configuration

      Returns Promise<LlmResponse>

      The response from the LLM

    • Returns the serialized chart data shared with all LLM providers, serializing on first use after a data change and caching thereafter.

      Exposed for the LLM model suppliers and tests; the caching strategy is an implementation detail and not part of the stable public API.

      Returns string

      The current chart data as a JSON string

    • Refreshes the chart data shared with the LLM providers after a live data update, so AI answers reflect the data currently on screen. Serialization is deferred until the next LLM request, and the shared plot image is dropped so the next message rasterises the updated plot.

      Parameters

      • maidr: Maidr

        The updated MAIDR data structure

      Returns void

    • Aborts any in-flight LLM requests and releases their resources. Invoked from Controller.dispose() when the plot loses focus, so a slow provider cannot keep the request continuation (and its waiting tone) alive for the full request timeout after disposal.

      Returns void