gui: emit dataChanged on block close for segment updates

When a complete block arrives in a single streaming chunk, the QML
Repeater may not pick up intermediate segment updates because the
event loop hasn't run. Emit an explicit dataChanged with SegmentsRole
when [[[end]]] closes a block, ensuring the delegate shows the final
rendered content.
This commit is contained in:
Levi Neely 2026-08-09 11:57:49 +02:00
parent c6da563109
commit 59e1992f37
1 changed files with 6 additions and 0 deletions

View File

@ -759,6 +759,12 @@ void ChatBlockModel::processLine(const QString &line)
case State::BlockEnd: case State::BlockEnd:
// [[[end]]] closes the current block // [[[end]]] closes the current block
if (s_endRe.match(line).hasMatch()) { if (s_endRe.match(line).hasMatch()) {
// Emit final update so QML picks up the completed segment state.
if (!m_blocks.isEmpty()) {
int blockIndex = m_blocks.size() - 1;
QModelIndex idx = index(blockIndex);
emit dataChanged(idx, idx, {ContentRole, RenderedHtmlRole, SegmentsRole});
}
m_state = State::BlockStart; m_state = State::BlockStart;
return; return;
} }