mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-14 02:09:22 -04:00
refactor: Move to agent-session architecture
This commit is contained in:
50
sources/providers/GenericProvider.hpp
Normal file
50
sources/providers/GenericProvider.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2024-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "Provider.hpp"
|
||||
|
||||
namespace LLMQore {
|
||||
class BaseClient;
|
||||
}
|
||||
|
||||
namespace QodeAssist::Providers {
|
||||
|
||||
// A configuration-driven provider: it owns an LLMQore client and exposes a
|
||||
// fixed identity/capability set. Concrete behaviour (request shape) comes from
|
||||
// the agent's prompt template via Provider::prepareRequest, so a single class
|
||||
// covers every client_api by varying the client factory + metadata.
|
||||
class GenericProvider : public Provider
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using ClientFactory = std::function<::LLMQore::BaseClient *(QObject *)>;
|
||||
|
||||
GenericProvider(
|
||||
QString name,
|
||||
ProviderID id,
|
||||
ProviderCapabilities capabilities,
|
||||
const ClientFactory &clientFactory,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
QString name() const override;
|
||||
QFuture<QList<QString>> getInstalledModels(const QString &url) override;
|
||||
ProviderID providerID() const override;
|
||||
ProviderCapabilities capabilities() const override;
|
||||
::LLMQore::BaseClient *client() const override;
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
ProviderID m_id;
|
||||
ProviderCapabilities m_capabilities;
|
||||
::LLMQore::BaseClient *m_client;
|
||||
};
|
||||
|
||||
// Registers every built-in client_api into ProviderFactory. Must be called once
|
||||
// at plugin startup before any agent/session is created.
|
||||
void registerBuiltinProviders();
|
||||
|
||||
} // namespace QodeAssist::Providers
|
||||
Reference in New Issue
Block a user