diff --git a/chat/ChatClientInterface.cpp b/chat/ChatClientInterface.cpp index 34d7942..65ce9bd 100644 --- a/chat/ChatClientInterface.cpp +++ b/chat/ChatClientInterface.cpp @@ -103,6 +103,14 @@ void ChatClientInterface::sendMessage(const QString &message) m_requestHandler->sendLLMRequest(config, request); } +void ChatClientInterface::clearMessages() +{ + m_chatHistory = {}; + m_accumulatedResponse.clear(); + m_pendingMessage.clear(); + logMessage("Chat history cleared"); +} + void ChatClientInterface::handleLLMResponse(const QString &response, bool isComplete) { m_accumulatedResponse += response; diff --git a/chat/ChatClientInterface.hpp b/chat/ChatClientInterface.hpp index f1d7b69..16267dc 100644 --- a/chat/ChatClientInterface.hpp +++ b/chat/ChatClientInterface.hpp @@ -35,6 +35,7 @@ public: ~ChatClientInterface(); void sendMessage(const QString &message); + void clearMessages(); signals: void messageReceived(const QString &message); diff --git a/chat/ChatWidget.cpp b/chat/ChatWidget.cpp index dadc8f0..1dbac73 100644 --- a/chat/ChatWidget.cpp +++ b/chat/ChatWidget.cpp @@ -134,6 +134,7 @@ void ChatWidget::clear() { m_chatDisplay->clear(); m_currentAIResponse.clear(); + m_chatClient->clearMessages(); } void ChatWidget::scrollToBottom() diff --git a/chat/ChatWidget.h b/chat/ChatWidget.h index 94bbba0..cef4f64 100644 --- a/chat/ChatWidget.h +++ b/chat/ChatWidget.h @@ -40,6 +40,7 @@ public: void setShowTimestamp(bool show); void receiveMessage(const QString &message); + private slots: void sendMessage(); void receivePartialMessage(const QString &partialMessage);