mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-14 02:09:22 -04:00
refactor: Move to agent-session architecture
This commit is contained in:
@@ -106,6 +106,19 @@ bool Session::isInFlight() const noexcept
|
||||
return !m_inFlight.isEmpty();
|
||||
}
|
||||
|
||||
LLMQore::BaseClient *Session::client() const noexcept
|
||||
{
|
||||
auto *provider = m_agent ? m_agent->provider() : nullptr;
|
||||
return provider ? provider->client() : nullptr;
|
||||
}
|
||||
|
||||
bool Session::supportsImages() const noexcept
|
||||
{
|
||||
auto *provider = m_agent ? m_agent->provider() : nullptr;
|
||||
return provider
|
||||
&& provider->capabilities().testFlag(Providers::ProviderCapability::Image);
|
||||
}
|
||||
|
||||
void Session::setContentLoader(ContentLoader loader)
|
||||
{
|
||||
m_contentLoader = std::move(loader);
|
||||
@@ -186,6 +199,13 @@ LLMQore::RequestID Session::sendCompletion(Templates::ContextData ctx)
|
||||
auto *tmpl = m_agent->promptTemplate();
|
||||
const auto &cfg = m_agent->config();
|
||||
|
||||
const QString rolePrompt = m_systemPrompt ? m_systemPrompt->compose() : QString();
|
||||
if (!rolePrompt.isEmpty()) {
|
||||
ctx.systemPrompt = (ctx.systemPrompt && !ctx.systemPrompt->isEmpty())
|
||||
? rolePrompt + QStringLiteral("\n\n") + *ctx.systemPrompt
|
||||
: rolePrompt;
|
||||
}
|
||||
|
||||
QJsonObject payload{{QStringLiteral("model"), cfg.model}};
|
||||
if (!provider->prepareRequest(payload, tmpl, ctx, /*tools=*/false, /*thinking=*/false))
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user