Skip to content

Commit

Permalink
🐛 fix: Removing message from chat after complete receiving
Browse files Browse the repository at this point in the history
  • Loading branch information
Palm1r committed Nov 25, 2024
1 parent 6503887 commit 36d5242
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ChatView/ClientInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,16 @@ void ClientInterface::handleLLMResponse(const QString &response,
const QJsonObject &request,
bool isComplete)
{
QString messageId = request["id"].toString();
m_chatModel->addMessage(response.trimmed(), ChatModel::ChatRole::Assistant, messageId);
const auto message = response.trimmed();

if (isComplete) {
LOG_MESSAGE("Message completed. Final response for message " + messageId + ": " + response);
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);
}
}
}

Expand Down

0 comments on commit 36d5242

Please sign in to comment.