mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-14 02:09:22 -04:00
refactor: Remove project rules
This commit is contained in:
@@ -125,10 +125,10 @@ void ChatCompressor::startCompression(const QString &chatFilePath, ChatModel *ch
|
||||
std::vector<std::unique_ptr<LLMQore::ContentBlock>> blocks;
|
||||
blocks.push_back(std::make_unique<LLMQore::TextContent>(buildCompressionPrompt()));
|
||||
|
||||
m_currentRequestId = session->send(
|
||||
std::move(blocks), /*toolsOverride=*/false, /*thinkingOverride=*/false);
|
||||
m_currentRequestId = session->send(std::move(blocks), /*toolsOverride=*/false);
|
||||
if (m_currentRequestId.isEmpty()) {
|
||||
handleCompressionError(tr("Failed to start compression request"));
|
||||
handleCompressionError(tr("Failed to start compression request: %1")
|
||||
.arg(session->lastError().message));
|
||||
return;
|
||||
}
|
||||
LOG_MESSAGE(QString("Starting compression request: %1").arg(m_currentRequestId));
|
||||
|
||||
@@ -390,22 +390,6 @@ void ChatModel::addToolExecutionStatus(
|
||||
}
|
||||
}
|
||||
|
||||
void ChatModel::dropTrailingAssistantMessage(const QString &requestId)
|
||||
{
|
||||
if (m_messages.isEmpty())
|
||||
return;
|
||||
|
||||
const Message &last = m_messages.last();
|
||||
if (last.role != ChatRole::Assistant || last.id != requestId)
|
||||
return;
|
||||
|
||||
const int idx = m_messages.size() - 1;
|
||||
beginRemoveRows(QModelIndex(), idx, idx);
|
||||
m_messages.removeLast();
|
||||
endRemoveRows();
|
||||
LOG_MESSAGE(QString("Dropped leaked pre-tool assistant message at index %1").arg(idx));
|
||||
}
|
||||
|
||||
void ChatModel::setToolMessageData(
|
||||
const QString &toolId,
|
||||
const QString &toolName,
|
||||
|
||||
@@ -102,7 +102,6 @@ public:
|
||||
const QString &toolId,
|
||||
const QString &toolName,
|
||||
const QJsonObject &toolArguments);
|
||||
void dropTrailingAssistantMessage(const QString &requestId);
|
||||
void setToolMessageData(
|
||||
const QString &toolId,
|
||||
const QString &toolName,
|
||||
|
||||
@@ -268,8 +268,8 @@ void ClientInterface::sendMessage(
|
||||
|
||||
const LLMQore::RequestID requestId = session->send(std::move(blocks));
|
||||
if (requestId.isEmpty()) {
|
||||
const QString error = QStringLiteral("Failed to start chat request for agent: %1")
|
||||
.arg(m_activeAgent);
|
||||
const QString error = QStringLiteral("Failed to start chat request for agent '%1': %2")
|
||||
.arg(m_activeAgent, session->lastError().message);
|
||||
LOG_MESSAGE(error);
|
||||
m_sessionManager->removeSession(session);
|
||||
emit errorOccurred(error);
|
||||
@@ -277,7 +277,7 @@ void ClientInterface::sendMessage(
|
||||
}
|
||||
|
||||
QJsonObject request{{"id", requestId}};
|
||||
m_activeRequests[requestId] = {request, session, /*dropPreToolText=*/false};
|
||||
m_activeRequests[requestId] = {request, session};
|
||||
|
||||
emit requestStarted(requestId);
|
||||
}
|
||||
@@ -613,15 +613,11 @@ void ClientInterface::handleToolExecutionStarted(
|
||||
const QString &toolName,
|
||||
const QJsonObject &arguments)
|
||||
{
|
||||
const auto requestIt = m_activeRequests.constFind(requestId);
|
||||
if (requestIt == m_activeRequests.constEnd()) {
|
||||
if (!m_activeRequests.contains(requestId)) {
|
||||
LOG_MESSAGE(QString("Ignoring tool execution start for non-chat request: %1").arg(requestId));
|
||||
return;
|
||||
}
|
||||
|
||||
if (requestIt->dropPreToolText) {
|
||||
m_chatModel->dropTrailingAssistantMessage(requestId);
|
||||
}
|
||||
m_chatModel->addToolExecutionStatus(requestId, toolId, toolName, arguments);
|
||||
m_awaitingContinuation.insert(requestId);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,6 @@ private:
|
||||
{
|
||||
QJsonObject originalRequest;
|
||||
QPointer<Session> session;
|
||||
bool dropPreToolText = false;
|
||||
};
|
||||
|
||||
ChatModel *m_chatModel;
|
||||
|
||||
Reference in New Issue
Block a user