main
mula.liu 2026-03-02 11:15:38 +08:00
parent ee25f7ea5a
commit d20bdc959f
2 changed files with 13 additions and 1 deletions

View File

@ -390,7 +390,7 @@
}
.ops-chat-text {
white-space: pre-wrap;
white-space: normal;
word-break: break-word;
overflow-wrap: anywhere;
line-height: 1.58;
@ -398,6 +398,10 @@
color: var(--text);
}
.ops-chat-text .whitespace-pre-wrap {
white-space: pre-wrap;
}
.ops-chat-text.is-collapsed {
max-height: 220px;
overflow: hidden;
@ -429,6 +433,10 @@
margin: 8px 0;
}
.ops-chat-text p:empty {
margin: 0;
}
.ops-chat-text pre {
margin: 8px 0;
overflow: auto;

View File

@ -51,6 +51,10 @@ export function normalizeAssistantMessageText(input: string) {
// Remove dashboard wrapper if channel accidentally outputs raw marker line.
text = text.replace(/__DASHBOARD_DATA_START__/g, '').replace(/__DASHBOARD_DATA_END__/g, '').trim();
// Keep HTML-enabled markdown readable: cap excessive HTML line breaks/empty paragraphs.
text = text.replace(/(?:<br\s*\/?>\s*){4,}/gi, '<br><br>');
text = text.replace(/(?:<p>(?:\s|&nbsp;|<br\s*\/?>)*<\/p>\s*){3,}/gi, '<p><br></p>');
// Reduce excessive blank lines while keeping markdown readability.
text = text.replace(/\n{4,}/g, '\n\n\n');
return text;