|
| 1 | +/* |
| 2 | + * Copyright (C) 2024 Petr Mironychev |
| 3 | + * |
| 4 | + * This file is part of QodeAssist. |
| 5 | + * |
| 6 | + * QodeAssist is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * QodeAssist is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with QodeAssist. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include "RequestConfig.hpp" |
| 23 | +#include <QJsonObject> |
| 24 | +#include <QObject> |
| 25 | + |
| 26 | +namespace QodeAssist::LLMCore { |
| 27 | + |
| 28 | +class RequestHandlerBase : public QObject |
| 29 | +{ |
| 30 | + Q_OBJECT |
| 31 | + |
| 32 | +public: |
| 33 | + explicit RequestHandlerBase(QObject *parent = nullptr); |
| 34 | + ~RequestHandlerBase() override; |
| 35 | + |
| 36 | + virtual void sendLLMRequest(const LLMConfig &config, const QJsonObject &request) = 0; |
| 37 | + virtual bool cancelRequest(const QString &id) = 0; |
| 38 | + |
| 39 | +signals: |
| 40 | + void completionReceived(const QString &completion, const QJsonObject &request, bool isComplete); |
| 41 | + void requestFinished(const QString &requestId, bool success, const QString &errorString); |
| 42 | + void requestCancelled(const QString &id); |
| 43 | +}; |
| 44 | + |
| 45 | +} // namespace QodeAssist::LLMCore |
0 commit comments