Utils::AiResponse Class
class Utils::AiResponseThe AiResponse class follows one submitted AiRequest. More...
| Header: | #include <aiassistance.h> |
| Inherits: | QObject |
Public Functions
| void | cancel() |
| bool | isFinished() const |
| void | reportFinished(const Utils::Result<QString> &result) |
| void | reportText(const QString &chunk) |
Signals
| void | cancelRequested() |
| void | finished(const Utils::Result<QString> &result) |
| void | textReceived(const QString &chunk) |
Detailed Description
finished() is emitted exactly once. For an interactive request it reports an empty string once the request was handed over, for example when the chat showing it was opened. For a headless request it reports the whole answer, after textReceived() delivered it in pieces.
The response deletes itself after finished(). It is never emitted before the event loop ran, so connecting right after submit() is in time.
Member Function Documentation
void AiResponse::cancel()
Asks the provider to stop. The response finishes with an error right away, whatever the provider reports afterwards.
[signal] void AiResponse::cancelRequested()
Asks the provider to stop working on the request.
[signal] void AiResponse::finished(const Utils::Result<QString> &result)
Reports the end of the request with result: the whole answer of a headless request, an empty string for an interactive one, or an error.
bool AiResponse::isFinished() const
Returns whether finished() was emitted.
void AiResponse::reportFinished(const Utils::Result<QString> &result)
Reports the end of the request with result, the whole answer or an error. Later calls are ignored. For providers.
void AiResponse::reportText(const QString &chunk)
Reports the next chunk of the answer. For providers.
[signal] void AiResponse::textReceived(const QString &chunk)
Reports the next chunk of the answer of a headless request.
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.