Creates a new ChatService instance with configured LLM models.
The display service for managing UI focus
The text service for retrieving coordinate text
The MAIDR data structure
Sends a message to the specified LLM model and returns the response.
The LLM provider to use
The request containing the message and configuration
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.
The current chart data as a JSON string
Freezes what the AI is grounded on: the plot image exactly as it looks now (highlight on the focused point included), the verbose description of that point, and the MAIDR JSON.
Call it at the moment the user triggers a question and hand the result to every provider answering it, so they share one rasterisation and none of them sees a plot the user has since navigated away from. The plot is serialised synchronously inside this call; only the decode and JPEG encoding that follow are asynchronous, and they work from that copy.
The frozen context for one question
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.
The updated MAIDR data structure
Toggles the focus to the chat scope.
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.
Service for managing chat interactions with different LLM providers.