refactor: Add agents for providers

This commit is contained in:
Petr Mironychev
2026-06-02 01:10:29 +02:00
parent 6220308a93
commit 98a618cf87
15 changed files with 238 additions and 127 deletions

View File

@@ -5,6 +5,8 @@
#include <utility>
#include <QJsonObject>
#include <LLMQore/BaseClient.hpp>
#include <LLMQore/ClaudeClient.hpp>
#include <LLMQore/GoogleAIClient.hpp>
@@ -58,6 +60,20 @@ QFuture<QList<QString>> GenericProvider::getInstalledModels(const QString &url)
return m_client->listModels();
}
RequestID GenericProvider::sendRequest(
const QUrl &url, const QJsonObject &payload, const QString &endpoint)
{
// Gemini carries the model in the URL and rejects unknown body fields, so
// the model/stream keys injected by the generic pipeline must be dropped.
if (m_id == ProviderID::GoogleAI) {
QJsonObject cleaned = payload;
cleaned.remove("model");
cleaned.remove("stream");
return Provider::sendRequest(url, cleaned, endpoint);
}
return Provider::sendRequest(url, payload, endpoint);
}
namespace {
using Cap = ProviderCapability;