HttpAiProvider.h header
#include <ew/app/HttpAiProvider.h>
Namespace ew::app
HttpAiProvider class
class ew::app::HttpAiProvider
An AiProvider that reaches a real model over HTTP: it POSTs an OpenAI-compatible chat-completions request to the endpoint in its AiSettings and parses the reply. Provider- agnostic – it works against any endpoint speaking that shape, whether a hosted API or a local server, with the endpoint, key, and model all supplied from settings and never hard-coded.
send() is synchronous: it blocks the calling thread until the reply arrives or the request times out. Callers on the GUI thread should therefore run it off the GUI thread (for example via QtConcurrent) so the interface stays responsive; the provider is self-contained (it owns a private network manager and event loop per call) so it is safe to run from a worker thread.
Members
ew::app::HttpAiProvider::HttpAiProvider(AiSettings settings)
Constructs a provider that sends to settings' endpoint using its API key and model.
AiResponse ew::app::HttpAiProvider::send(const AiRequest &request) override
POSTs request to the configured endpoint and returns the model's reply, or an AiResponse carrying a network, HTTP, or parse error. The request's model is filled from settings when it is empty (as the AiPrompts helpers leave it). Returns an error without any network call when the provider is not configured.
bool ew::app::HttpAiProvider::isConfigured() const override
True when the settings carry both an endpoint and a model.