On this page

Utils::AiRequestRunner Class

class Utils::AiRequestRunner

The AiRequestRunner class runs an AiRequest as a task, which AiRequestTask puts into a task tree. More...

Header: #include <aiassistance.h>
Inherits: QObject

Public Functions

AiRequestRunner()
virtual ~AiRequestRunner() override
Utils::Result<QString> result() const
void setRequest(const Utils::AiRequest &request)
void setSelection(const Utils::AiTargetSelection &selection)
void start()

Signals

void done(QtTaskTree::DoneResult result)
void textReceived(const QString &chunk)

Detailed Description

Without a selection, the user picks the target. The request counts as successful when it finishes with an answer, which result() returns. A runner that is destroyed while its request runs, such as by stopping its task tree, cancels the request.

Member Function Documentation

AiRequestRunner::AiRequestRunner()

Creates a runner without a request.

[override virtual noexcept] AiRequestRunner::~AiRequestRunner()

Cancels the request if it runs.

[signal] void AiRequestRunner::done(QtTaskTree::DoneResult result)

Reports the end of the request with result, which is a success if there is an answer.

Utils::Result<QString> AiRequestRunner::result() const

Returns the answer, or an error if the request failed or has not finished.

void AiRequestRunner::setRequest(const Utils::AiRequest &request)

Sets the request to run.

void AiRequestRunner::setSelection(const Utils::AiTargetSelection &selection)

Runs the request on the target in selection, without asking the user.

void AiRequestRunner::start()

Submits the request.

[signal] void AiRequestRunner::textReceived(const QString &chunk)

Reports the next chunk of the answer of a headless request.

Related Non-Members

[alias] AiRequestTask

A task that runs an AiRequestRunner in a task tree.

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.