Skip to content

Commit 7614f6b

Browse files
garthvhclaude
andcommitted
dashboard: preview shows the message typed after an interrupt
After an interrupt, Claude Code folds the aborted turn(s) plus a '[Request interrupted by user]' marker into the same user message before the new text, so the preview showed the stale history (e.g. 'yo dawg... are you a narc? [Request interrupted by user] hi') instead of what was actually typed. humanText now splits on the marker and keeps only what follows it — so that row reads 'hi'. Falls back to the raw text for a marker-only turn. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e2fad09 commit 7614f6b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

server.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,13 @@ function blockText(content) {
323323
// them so the column shows what was typed, not the boilerplate. Falls back to the
324324
// raw text for turns that are only injected content (e.g. tool-result turns).
325325
function humanText(content) {
326-
const raw = blockText(content ?? "");
327-
const stripped = raw
328-
.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi, " ")
329-
.replace(/\s+/g, " ")
330-
.trim();
331-
return stripped || raw.replace(/\s+/g, " ").trim();
326+
const raw = blockText(content ?? "").replace(/<system-reminder>[\s\S]*?<\/system-reminder>/gi, " ");
327+
// After an interrupt, Claude Code folds the aborted turn(s) plus a
328+
// "[Request interrupted by user]" marker into the same user message; the actual
329+
// new message is whatever the user typed after the last such marker.
330+
const segments = raw.split(/\[Request interrupted by user[^\]]*\]/gi);
331+
const tail = segments[segments.length - 1].replace(/\s+/g, " ").trim();
332+
return tail || raw.replace(/\s+/g, " ").trim();
332333
}
333334

334335
function anthropicToOllamaMessages(body) {

0 commit comments

Comments
 (0)