mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-07-01 10:39:14 -04:00
fix: Disable shown agent without selecting
This commit is contained in:
@@ -155,6 +155,7 @@ void AgentFactory::reload()
|
||||
|
||||
QDir().mkpath(userAgentsDir());
|
||||
auto result = Agents::AgentLoader::load(agentQrcPrefix(), userAgentsDir());
|
||||
m_sourcePathByName = std::move(result.sourcePathByName);
|
||||
for (const QString &err : result.errors)
|
||||
LOG_MESSAGE(QString("[Agents] error: %1").arg(err));
|
||||
for (const QString &warn : result.warnings)
|
||||
@@ -212,6 +213,11 @@ const AgentConfig *AgentFactory::configByName(const QString &name) const
|
||||
return &m_configs[it.value()];
|
||||
}
|
||||
|
||||
QString AgentFactory::sourcePathForName(const QString &name) const
|
||||
{
|
||||
return m_sourcePathByName.value(name);
|
||||
}
|
||||
|
||||
QStringList AgentFactory::configNames() const
|
||||
{
|
||||
QStringList out;
|
||||
@@ -323,6 +329,7 @@ void AgentFactory::clear()
|
||||
Q_ASSERT(thread() == QThread::currentThread());
|
||||
m_configs.clear();
|
||||
m_indexByName.clear();
|
||||
m_sourcePathByName.clear();
|
||||
m_baseModelByName.clear();
|
||||
m_baseProviderByName.clear();
|
||||
m_baseToolsByName.clear();
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
[[nodiscard]] static QString userConfigDir();
|
||||
|
||||
[[nodiscard]] const AgentConfig *configByName(const QString &name) const;
|
||||
[[nodiscard]] QString sourcePathForName(const QString &name) const;
|
||||
[[nodiscard]] QStringList configNames() const;
|
||||
[[nodiscard]] const std::vector<AgentConfig> &configs() const noexcept { return m_configs; }
|
||||
|
||||
@@ -77,6 +78,7 @@ signals:
|
||||
private:
|
||||
std::vector<AgentConfig> m_configs;
|
||||
QHash<QString, qsizetype> m_indexByName;
|
||||
QHash<QString, QString> m_sourcePathByName;
|
||||
QHash<QString, QString> m_baseModelByName;
|
||||
QHash<QString, QString> m_baseProviderByName;
|
||||
QHash<QString, bool> m_baseToolsByName;
|
||||
|
||||
@@ -348,6 +348,9 @@ AgentLoader::LoadResult AgentLoader::load(const QString &qrcPrefix, const QStrin
|
||||
scanDir(qrcPrefix, /*isUserLayer=*/false, raw, result.errors, &result.warnings);
|
||||
scanDir(userDir, /*isUserLayer=*/true, raw, result.errors, &result.warnings);
|
||||
|
||||
for (auto it = raw.constBegin(); it != raw.constEnd(); ++it)
|
||||
result.sourcePathByName.insert(it.key(), it.value().filePath);
|
||||
|
||||
for (auto it = raw.constBegin(); it != raw.constEnd(); ++it) {
|
||||
const QString &name = it.key();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <vector>
|
||||
@@ -18,6 +19,7 @@ public:
|
||||
struct LoadResult
|
||||
{
|
||||
std::vector<AgentConfig> configs;
|
||||
QHash<QString, QString> sourcePathByName;
|
||||
QStringList errors;
|
||||
QStringList warnings;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user