mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-14 02:09:22 -04:00
refactor: Agent roaster improve
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <AgentConfig.hpp>
|
||||
#include <AgentFactory.hpp>
|
||||
#include <sources/settings/PipelinesConfig.hpp>
|
||||
|
||||
namespace QodeAssist::Chat {
|
||||
|
||||
@@ -52,7 +53,20 @@ void ChatAgentController::setCurrentAgent(const QString &name)
|
||||
|
||||
void ChatAgentController::reload()
|
||||
{
|
||||
m_availableAgents = m_agentFactory ? m_agentFactory->configNames() : QStringList{};
|
||||
const QStringList all = m_agentFactory ? m_agentFactory->configNames() : QStringList{};
|
||||
const QStringList roster = Settings::PipelinesConfig::load().rosters.chatAssistant;
|
||||
|
||||
if (roster.isEmpty()) {
|
||||
m_availableAgents = all;
|
||||
} else {
|
||||
QStringList filtered;
|
||||
for (const QString &name : roster) {
|
||||
if (all.contains(name))
|
||||
filtered.append(name);
|
||||
}
|
||||
m_availableAgents = filtered.isEmpty() ? all : filtered;
|
||||
}
|
||||
|
||||
emit availableAgentsChanged();
|
||||
ensureValidCurrent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user