diff --git a/ChatView/ClientInterface.cpp b/ChatView/ClientInterface.cpp index d38ae37..477aee1 100644 --- a/ChatView/ClientInterface.cpp +++ b/ChatView/ClientInterface.cpp @@ -307,14 +307,14 @@ void ClientInterface::sendMessage( connect( provider, &LLMCore::Provider::thinkingBlockReceived, - m_chatModel, - &ChatModel::addThinkingBlock, + this, + &ClientInterface::handleThinkingBlockReceived, Qt::UniqueConnection); connect( provider, &LLMCore::Provider::redactedThinkingBlockReceived, - m_chatModel, - &ChatModel::addRedactedThinkingBlock, + this, + &ClientInterface::handleRedactedThinkingBlockReceived, Qt::UniqueConnection); provider->sendRequest(requestId, config.url, config.providerRequest); @@ -475,6 +475,29 @@ void ClientInterface::handleCleanAccumulatedData(const QString &requestId) LOG_MESSAGE(QString("Cleared accumulated responses for continuation request %1").arg(requestId)); } +void ClientInterface::handleThinkingBlockReceived( + const QString &requestId, const QString &thinking, const QString &signature) +{ + if (!m_activeRequests.contains(requestId)) { + LOG_MESSAGE(QString("Ignoring thinking block for non-chat request: %1").arg(requestId)); + return; + } + + m_chatModel->addThinkingBlock(requestId, thinking, signature); +} + +void ClientInterface::handleRedactedThinkingBlockReceived( + const QString &requestId, const QString &signature) +{ + if (!m_activeRequests.contains(requestId)) { + LOG_MESSAGE( + QString("Ignoring redacted thinking block for non-chat request: %1").arg(requestId)); + return; + } + + m_chatModel->addRedactedThinkingBlock(requestId, signature); +} + bool ClientInterface::isImageFile(const QString &filePath) const { static const QSet imageExtensions = {"png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"}; diff --git a/ChatView/ClientInterface.hpp b/ChatView/ClientInterface.hpp index 0a4f782..0fd895c 100644 --- a/ChatView/ClientInterface.hpp +++ b/ChatView/ClientInterface.hpp @@ -63,6 +63,9 @@ private slots: void handleFullResponse(const QString &requestId, const QString &fullText); void handleRequestFailed(const QString &requestId, const QString &error); void handleCleanAccumulatedData(const QString &requestId); + void handleThinkingBlockReceived( + const QString &requestId, const QString &thinking, const QString &signature); + void handleRedactedThinkingBlockReceived(const QString &requestId, const QString &signature); private: void handleLLMResponse(const QString &response, const QJsonObject &request);