feat(frontend): enhance chat markdown rendering and streaming behavior

- Introduce functions to stabilize rendering of dangling inline markers during streaming, preventing flickering and layout shifts.
- Implement tagging for standalone strong paragraphs to ensure consistent styling as subtitles.
- Update CSS for chat components to improve animation smoothness and visual feedback during typing.
- Add tests for new markdown rendering features, including handling of incomplete emphasis and citation tags.
This commit is contained in:
wizardchen
2026-06-19 23:05:20 +08:00
committed by lyingbug
parent ae9038732a
commit 58461a5b68
9 changed files with 477 additions and 21 deletions
@@ -46,7 +46,12 @@
}
// Models often emit standalone **小节标题:** paragraphs instead of headings.
:deep(p:has(> strong:only-child)) {
// Tagged at render time (markStandaloneStrongParagraphs) rather than via
// `p:has(> strong:only-child)`: CSS `:only-child` ignores text nodes, so the
// selector matched any paragraph whose only *element* child was a <strong>,
// causing a visible top-margin jump mid-stream the instant one **bold** run
// closed inside an otherwise text-heavy paragraph.
:deep(p.md-strong-title) {
margin-top: 1.25em;
margin-bottom: 0.5em;
line-height: 1.5;
@@ -3,11 +3,11 @@
0%,
60%,
100% {
transform: translateY(0);
transform: translate3d(0, 0, 0);
}
30% {
transform: translateY(-8px);
transform: translate3d(0, -5px, 0);
}
}
@@ -52,6 +52,10 @@
border-radius: 50%;
background: var(--td-text-color-placeholder);
animation: chatTimelineTypingBounce 1.4s ease-in-out infinite;
// Composite each dot on its own layer so the bounce runs off the main
// thread and does not smear/ghost while the answer relayouts every token.
will-change: transform;
backface-visibility: hidden;
&:nth-child(1) {
animation-delay: 0s;