|
OpenAnima 0.2.0
Middleware for conversational NPCs that interact with the player, the world and each other
|
#include <HttpTransport.h>
Static Public Member Functions | |
| static ResponseObserver | buffering (std::string &body) |
Public Attributes | |
| std::function< void(long statusCode)> | onStatus |
| Called once the status is known and before any body arrives. | |
| std::function< bool(std::string_view body)> | onBody |
Watches a response while it is being received.
A buffered exchange only wants the body at the end. A streamed one, like the text/event-stream a chat-completions call answers with, wants every piece as it arrives, and wants the status before the first piece: the body of a rejected call is not a stream at all, and reading it as one hides the real error.
Both callbacks may be left empty, and are then simply not called.
|
static |
| body | String every piece is appended to. |
| std::function<bool(std::string_view body)> OpenAnima::Http::ResponseObserver::onBody |
Called for each piece of the body, in order.
| body | Bytes just received; valid only for the duration of the call. |