MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / createFromFile

Method createFromFile

sources/agents/AgentFactory.cpp:182–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182Agent *AgentFactory::createFromFile(
183 const QString &tomlPath, QObject *parent, QString *errorOut) const
184{
185 QString parseErr;
186 QStringList warnings;
187 auto cfgOpt = Agents::AgentLoader::parseFile(tomlPath, &parseErr, &warnings);
188 if (!cfgOpt) {
189 if (errorOut) *errorOut = parseErr;
190 return nullptr;
191 }
192 Providers::Provider *provider = buildProviderForAgent(
193 *cfgOpt, m_instanceFactory.data(), m_secrets.data(), errorOut);
194 if (!provider)
195 return nullptr;
196 auto agent = std::make_unique<Agent>(std::move(*cfgOpt), provider, /*parent=*/nullptr);
197 if (!agent->isValid()) {
198 if (errorOut) *errorOut = agent->invalidReason();
199 return nullptr;
200 }
201 agent->setParent(parent);
202 return agent.release();
203}
204
205void AgentFactory::clear()
206{

Callers

nothing calls this directly

Calls 5

buildProviderForAgentFunction · 0.85
releaseMethod · 0.80
dataMethod · 0.45
isValidMethod · 0.45
invalidReasonMethod · 0.45

Tested by

no test coverage detected