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

Method dispatch

sources/Session/Session.cpp:204–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204LLMQore::RequestID Session::dispatch(std::optional<bool> toolsOverride)
205{
206 auto *provider = m_agent->provider();
207 auto *tmpl = m_agent->promptTemplate();
208 const auto &cfg = m_agent->config();
209
210 const QString renderedContext = renderAgentContext();
211 if (renderedContext.isEmpty())
212 m_systemPrompt->clearLayer(QStringLiteral("agent.context"));
213 else
214 m_systemPrompt->setLayer(QStringLiteral("agent.context"), renderedContext);
215
216 Templates::ContextData ctx = toLegacyContext();
217 QJsonObject payload{{QStringLiteral("model"), cfg.model}};
218
219 const bool tools = toolsOverride.value_or(cfg.enableTools);
220 if (!provider->prepareRequest(payload, tmpl, ctx, tools, cfg.enableThinking))
221 return {};
222
223 const auto id = provider->sendRequest(QUrl(provider->url()), payload, cfg.endpoint);
224 if (id.isEmpty())
225 return {};
226
227 m_inFlight = id;
228 if (m_router)
229 m_router->beginRequest(id);
230 emit started(id);
231 return id;
232}
233
234Templates::ContextData Session::toLegacyContext() const
235{

Callers

nothing calls this directly

Calls 9

providerMethod · 0.80
clearLayerMethod · 0.80
setLayerMethod · 0.80
beginRequestMethod · 0.80
promptTemplateMethod · 0.45
isEmptyMethod · 0.45
prepareRequestMethod · 0.45
sendRequestMethod · 0.45
urlMethod · 0.45

Tested by

no test coverage detected