mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-20 10:10:56 -04:00
refactor: Restructure project into sources/tests layout and dissolve PluginLLMCore
This commit is contained in:
67
sources/settings/AgentRole.hpp
Normal file
67
sources/settings/AgentRole.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright (C) 2024-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
namespace QodeAssist::Settings {
|
||||
|
||||
struct AgentRole
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
QString description;
|
||||
QString systemPrompt;
|
||||
bool isBuiltin = false;
|
||||
|
||||
QJsonObject toJson() const
|
||||
{
|
||||
return QJsonObject{
|
||||
{"id", id},
|
||||
{"name", name},
|
||||
{"description", description},
|
||||
{"systemPrompt", systemPrompt},
|
||||
{"isBuiltin", isBuiltin}};
|
||||
}
|
||||
|
||||
static AgentRole fromJson(const QJsonObject &json)
|
||||
{
|
||||
return AgentRole{
|
||||
json["id"].toString(),
|
||||
json["name"].toString(),
|
||||
json["description"].toString(),
|
||||
json["systemPrompt"].toString(),
|
||||
json["isBuiltin"].toBool(false)};
|
||||
}
|
||||
|
||||
bool operator==(const AgentRole &other) const { return id == other.id; }
|
||||
};
|
||||
|
||||
class AgentRolesManager
|
||||
{
|
||||
public:
|
||||
static QString getConfigurationDirectory();
|
||||
static QList<AgentRole> loadAllRoles();
|
||||
static AgentRole loadRole(const QString &roleId);
|
||||
static AgentRole loadRoleFromFile(const QString &filePath);
|
||||
static bool saveRole(const AgentRole &role);
|
||||
static bool deleteRole(const QString &roleId);
|
||||
static bool roleExists(const QString &roleId);
|
||||
static void ensureDefaultRoles();
|
||||
|
||||
static AgentRole getNoRole()
|
||||
{
|
||||
return AgentRole{"", "No Role", "Use base system prompt without role specialization", "", false};
|
||||
}
|
||||
|
||||
private:
|
||||
static AgentRole getDefaultDeveloperRole();
|
||||
static AgentRole getDefaultReviewerRole();
|
||||
static AgentRole getDefaultResearcherRole();
|
||||
};
|
||||
|
||||
} // namespace QodeAssist::Settings
|
||||
Reference in New Issue
Block a user