mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-05-30 19:09:14 -04:00
feat: Add settings page for providers (#353)
This commit is contained in:
57
sources/providersConfig/ProviderInstance.hpp
Normal file
57
sources/providersConfig/ProviderInstance.hpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2024-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include <QHash>
|
||||
#include <QJsonObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
namespace QodeAssist::Providers {
|
||||
|
||||
struct LaunchConfig
|
||||
{
|
||||
QString command;
|
||||
QStringList args;
|
||||
QString cwd;
|
||||
QHash<QString, QString> env;
|
||||
|
||||
QString readyUrl;
|
||||
std::chrono::seconds readyTimeout{30};
|
||||
|
||||
bool autoStart = false;
|
||||
|
||||
bool detach = false;
|
||||
|
||||
[[nodiscard]] bool isEmpty() const noexcept { return command.isEmpty(); }
|
||||
};
|
||||
|
||||
struct ProviderInstance
|
||||
{
|
||||
QString name;
|
||||
QString clientApi;
|
||||
QString description;
|
||||
QString url;
|
||||
QString apiKeyRef;
|
||||
QJsonObject extras;
|
||||
LaunchConfig launch;
|
||||
QString extendsName;
|
||||
bool abstract = false;
|
||||
|
||||
QString sourcePath;
|
||||
bool overridesBundled = false;
|
||||
[[nodiscard]] bool isUserSource() const
|
||||
{
|
||||
return !sourcePath.startsWith(QLatin1StringView{":/"});
|
||||
}
|
||||
|
||||
[[nodiscard]] static QString validate(
|
||||
const ProviderInstance &inst, const QStringList &knownClientApis);
|
||||
|
||||
[[nodiscard]] static QString warnings(const ProviderInstance &inst);
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Providers
|
||||
Reference in New Issue
Block a user