fix: room between the starter questions and the box; a half-arrived bold run streams as bold, not asterisks
All checks were successful
Forgejo Docker Build / Root app tests (push) Successful in 53s
Forgejo Docker Build / Build Docker image (push) Successful in 9s
Forgejo Docker Build / End-to-end (browser) (push) Successful in 5s

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
This commit is contained in:
Daniel 2026-09-13 18:56:41 +02:00
parent bbcc824b65
commit 1beb2d33b0
3 changed files with 13 additions and 3 deletions

View file

@ -23,13 +23,13 @@
#assistant-chat-view:not(:has(.assistant-msg)) { min-height:min(62vh, 640px); }
#assistant-chat-view:has(.assistant-msg) { min-height:calc(100vh - 190px); }
.assistant-messages:not(:has(.assistant-msg)) { display:flex; flex-direction:column; justify-content:center; }
.assistant-messages:not(:has(.assistant-msg)) .assistant-empty { margin:0 auto; }
.assistant-messages:not(:has(.assistant-msg)) .assistant-empty { margin:0 auto 28px; }
}
.assistant-messages { padding:16px; max-height:none; overflow-y:auto; overflow-x:hidden; background:transparent; min-width:0; }
.assistant-empty { max-width:680px; margin:50px auto; text-align:center; color:var(--g500); }
.assistant-empty i { font-size:34px; color:var(--blue); margin-bottom:10px; }
.assistant-empty h3 { color:var(--g800); font-size:18px; margin-bottom:6px; }
.assistant-examples { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:16px; }
.assistant-examples { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; margin-top:16px; margin-bottom:6px; }
.assistant-examples button { border:1px solid var(--g200); background:white; color:var(--g700); border-radius:999px; padding:7px 10px; font-size:12px; cursor:pointer; }
.assistant-suggestion-buttons { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.assistant-suggestion-buttons button { border:1px solid var(--blue-light); background:var(--blue-light); color:var(--blue); border-radius:999px; padding:7px 10px; font-size:12px; cursor:pointer; text-align:left; }

View file

@ -707,9 +707,14 @@ import {
// A header row with nothing under it yet is a table markdown-it would
// happily draw — two lines of pipes and an empty body. Not yet.
var headerOnly = !growing && TABLE_ROW.test(tail.trim().split('\n')[0] || '');
// A bold run whose closing ** has not arrived yet shows as literal
// asterisks for a frame or two; closing it for the render keeps the text
// bold from its first character. The real text is untouched.
var balanced = tail;
if ((tail.match(/\*\*/g) || []).length % 2 === 1) balanced = tail + '**';
if (tail && !openFence && !headerOnly) {
state.tail.className = 'assistant-stream-tail assistant-stream-partial';
state.tail.innerHTML = renderAssistantBubbleHtml(growing || tail, sources, false);
state.tail.innerHTML = renderAssistantBubbleHtml(growing || balanced, sources, false);
renderEmbeddedBlocks(state.tail);
state.tail.hidden = false;
} else {

View file

@ -332,3 +332,8 @@ test('opening the share panel does not redraw the library, and the Nextcloud upl
assert.match(panel, /mr-shared-note/);
assert.match(js, /createTextNode\(' Nextcloud'\)/);
});
test('a streaming tail with an unclosed bold run is rendered closed, and the starter questions keep clear of the box', () => {
assert.match(read('public/js/clinicalAssistant.js'), /if \(\(tail\.match\(\/\\\*\\\*\/g\) \|\| \[\]\)\.length % 2 === 1\) balanced = tail \+ '\*\*';/);
assert.match(read('public/css/assistant.css'), /\.assistant-empty \{ margin:0 auto 28px; \}/);
});