mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-14 02:09:22 -04:00
refactor: add to template agent roles
This commit is contained in:
41
sources/Session/ToolContributorRegistry.hpp
Normal file
41
sources/Session/ToolContributorRegistry.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2024-2026 Petr Mironychev
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace LLMQore {
|
||||
class ToolsManager;
|
||||
}
|
||||
|
||||
namespace QodeAssist {
|
||||
|
||||
class ToolContributorRegistry
|
||||
{
|
||||
public:
|
||||
using Contributor = std::function<void(LLMQore::ToolsManager *)>;
|
||||
|
||||
void add(Contributor contributor)
|
||||
{
|
||||
if (contributor)
|
||||
m_contributors.push_back(std::move(contributor));
|
||||
}
|
||||
|
||||
void contribute(LLMQore::ToolsManager *tools) const
|
||||
{
|
||||
if (!tools)
|
||||
return;
|
||||
for (const auto &contributor : m_contributors)
|
||||
contributor(tools);
|
||||
}
|
||||
|
||||
void clear() { m_contributors.clear(); }
|
||||
|
||||
private:
|
||||
std::vector<Contributor> m_contributors;
|
||||
};
|
||||
|
||||
} // namespace QodeAssist
|
||||
Reference in New Issue
Block a user