Revert "render system-user-interruption as styled yellow box in prose"

This reverts commit 4e455e2dd3.
This commit is contained in:
Levi Neely 2026-08-03 00:39:34 +02:00
parent 4e455e2dd3
commit 64883cf9b8
1 changed files with 6 additions and 8 deletions

View File

@ -194,28 +194,26 @@ QString ChatBlockModel::highlightCode(const QString &code, const QString &langua
QString ChatBlockModel::renderMarkdown(const QString &markdown) const
{
// Pre-process: render <system-user-interruption> blocks as styled boxes.
// These appear as prose between code fences (the server closes the tool
// output fence before the interruption and reopens it after).
// Manual global-match loop instead of replace-with-lambda, which requires
// Qt 6.5+ and isn't available on all target systems.
static const QRegularExpression interruptionRe(
R"(<system-user-interruption>\n([\s\S]*?)\n</system-user-interruption>)");
QString processed = markdown;
QString processed;
{
int cursor = 0;
QString rebuilt;
auto it = interruptionRe.globalMatch(markdown);
while (it.hasNext()) {
const auto match = it.next();
rebuilt += markdown.mid(cursor, match.capturedStart() - cursor);
processed += markdown.mid(cursor, match.capturedStart() - cursor);
const QString content = match.captured(1).toHtmlEscaped();
rebuilt += QStringLiteral(
processed += QStringLiteral(
"<div style=\"background:#fff8e1;border:1px solid #ffca28;"
"border-radius:4px;padding:8px;margin:8px 0;white-space:pre-wrap;\">"
"\u26A0\uFE0F <strong>User interruption</strong>\n")
+ content + QStringLiteral("</div>");
cursor = match.capturedEnd();
}
rebuilt += markdown.mid(cursor);
processed = rebuilt;
processed += markdown.mid(cursor);
}
static const QRegularExpression fenceRe(