From bb6df3a073da62cfcce03a2daa53cd48bbd363ab Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Thu, 20 Aug 2026 17:34:53 +0200 Subject: [PATCH] Hide context blocks in KDE chat --- kde/gui/chatblockmodel.cpp | 13 +++++++++++++ kde/gui/chatblockmodel.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/kde/gui/chatblockmodel.cpp b/kde/gui/chatblockmodel.cpp index 927e713..7a652ba 100644 --- a/kde/gui/chatblockmodel.cpp +++ b/kde/gui/chatblockmodel.cpp @@ -232,6 +232,7 @@ void ChatBlockModel::reset() beginResetModel(); m_blocks.clear(); m_lineBuffer.clear(); + m_inContext = false; m_state = State::BlockStart; m_inCodeFence = false; m_fenceLanguage.clear(); @@ -680,6 +681,18 @@ void ChatBlockModel::processLine(const QString &line) } case State::BlockEnd: + // Hide prompt context blocks from the rendered chat, matching olliesrv. + if (line.trimmed() == QStringLiteral("")) { + m_inContext = true; + return; + } + if (line.trimmed() == QStringLiteral("")) { + m_inContext = false; + return; + } + if (m_inContext) + return; + // [[[end]]] closes the current block if (s_endRe.match(line).hasMatch()) { // Emit final update so QML picks up the completed segment state. diff --git a/kde/gui/chatblockmodel.h b/kde/gui/chatblockmodel.h index da75296..d900765 100644 --- a/kde/gui/chatblockmodel.h +++ b/kde/gui/chatblockmodel.h @@ -134,6 +134,9 @@ private: QList m_blocks; QString m_lineBuffer; + // Context blocks are injected into prompts but hidden from chat rendering. + bool m_inContext = false; + // Code fence state (for streaming) bool m_inCodeFence = false; QString m_fenceLanguage;