From fea9ecddc8c87b3bb14f36d24f328272809524e5 Mon Sep 17 00:00:00 2001 From: Petr Mironychev <9195189+Palm1r@users.noreply.github.com> Date: Wed, 12 Nov 2025 20:32:01 +0100 Subject: [PATCH] fix: Remove replace message after complete receiving --- ChatView/ClientInterface.cpp | 16 +++++----------- ChatView/ClientInterface.hpp | 2 +- ChatView/qml/RootItem.qml | 12 ------------ ChatView/qml/ThinkingStatusItem.qml | 2 +- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/ChatView/ClientInterface.cpp b/ChatView/ClientInterface.cpp index 6ff560e..21f0e39 100644 --- a/ChatView/ClientInterface.cpp +++ b/ChatView/ClientInterface.cpp @@ -251,20 +251,13 @@ void ClientInterface::cancelRequest() LOG_MESSAGE("All requests cancelled and state cleared"); } -void ClientInterface::handleLLMResponse( - const QString &response, const QJsonObject &request, bool isComplete) +void ClientInterface::handleLLMResponse(const QString &response, const QJsonObject &request) { const auto message = response.trimmed(); if (!message.isEmpty()) { QString messageId = request["id"].toString(); m_chatModel->addMessage(message, ChatModel::ChatRole::Assistant, messageId); - - if (isComplete) { - LOG_MESSAGE( - "Message completed. Final response for message " + messageId + ": " + response); - emit messageReceivedCompletely(); - } } } @@ -323,7 +316,7 @@ void ClientInterface::handlePartialResponse(const QString &requestId, const QStr m_accumulatedResponses[requestId] += partialText; const RequestContext &ctx = it.value(); - handleLLMResponse(m_accumulatedResponses[requestId], ctx.originalRequest, false); + handleLLMResponse(m_accumulatedResponses[requestId], ctx.originalRequest); } void ClientInterface::handleFullResponse(const QString &requestId, const QString &fullText) @@ -345,10 +338,11 @@ void ClientInterface::handleFullResponse(const QString &requestId, const QString .arg(requestId, applyError)); } - handleLLMResponse(finalText, ctx.originalRequest, true); - m_activeRequests.erase(it); m_accumulatedResponses.remove(requestId); + + LOG_MESSAGE("Message completed. Final response for message " + ctx.originalRequest["id"].toString() + ": " + finalText); + emit messageReceivedCompletely(); } void ClientInterface::handleRequestFailed(const QString &requestId, const QString &error) diff --git a/ChatView/ClientInterface.hpp b/ChatView/ClientInterface.hpp index 9de0e0e..361ea23 100644 --- a/ChatView/ClientInterface.hpp +++ b/ChatView/ClientInterface.hpp @@ -61,7 +61,7 @@ private slots: void handleCleanAccumulatedData(const QString &requestId); private: - void handleLLMResponse(const QString &response, const QJsonObject &request, bool isComplete); + void handleLLMResponse(const QString &response, const QJsonObject &request); QString getCurrentFileContext() const; QString getSystemPromptWithLinkedFiles( const QString &basePrompt, const QList &linkedFiles) const; diff --git a/ChatView/qml/RootItem.qml b/ChatView/qml/RootItem.qml index 0e26a0a..ca1a177 100644 --- a/ChatView/qml/RootItem.qml +++ b/ChatView/qml/RootItem.qml @@ -215,7 +215,6 @@ ChatRootView { ThinkingStatusItem { width: parent.width thinkingContent: { - // Extract thinking content and signature let content = model.content let signatureStart = content.indexOf("\n[Signature:") if (signatureStart >= 0) { @@ -223,17 +222,6 @@ ChatRootView { } return content } - signature: { - let content = model.content - let signatureStart = content.indexOf("\n[Signature: ") - if (signatureStart >= 0) { - let signatureEnd = content.indexOf("...]", signatureStart) - if (signatureEnd >= 0) { - return content.substring(signatureStart + 13, signatureEnd) - } - } - return "" - } isRedacted: model.isRedacted !== undefined ? model.isRedacted : false } } diff --git a/ChatView/qml/ThinkingStatusItem.qml b/ChatView/qml/ThinkingStatusItem.qml index 4d74a90..85199d8 100644 --- a/ChatView/qml/ThinkingStatusItem.qml +++ b/ChatView/qml/ThinkingStatusItem.qml @@ -24,7 +24,7 @@ Rectangle { id: root property string thinkingContent: "" - property string signature: "" + // property string signature: "" property bool isRedacted: false property bool expanded: false