Streaming-Cursor: Block-Cursor-Stil, schnelleres Blinken, korrekte Inline-Positionierung

This commit is contained in:
Meleki committed 2026-02-28 21:48:15 +01:00
1 parent e79a69a364
commit f20d94b08f
2 files changed
+14 -13

No files matched your search

+6 -11
View File
@@ -122,17 +122,18 @@
.msg .cursor { .msg .cursor {
display: inline-block; display: inline-block;
width: .125em; width: .55em;
height: 1em; height: 1.15em;
background: var(--text); background: var(--text);
animation: blink 0.8s infinite; animation: blink .2s step-end infinite;
vertical-align: text-bottom; vertical-align: text-bottom;
margin-left: .125em; margin-left: .15em;
border-radius: 1px;
} }
@keyframes blink { @keyframes blink {
0%, 50% { opacity: 1; } 0%, 50% { opacity: 1; }
51%, 100% { opacity: 0; } 50.1%, 100% { opacity: 0; }
} }
.tool-box { .tool-box {
@@ -502,9 +503,3 @@
max-height: 60vh; max-height: 60vh;
overflow: auto; overflow: auto;
} }
/* Message-Typ Button */
.cmd-type-message {
font-style: italic;
}
+8 -2
View File
@@ -121,7 +121,7 @@ let _streamText = '';
function startStreamBubble() { function startStreamBubble() {
_streamDiv = document.createElement('div'); _streamDiv = document.createElement('div');
_streamDiv.className = 'msg assistant markdown streamed'; _streamDiv.className = 'msg assistant markdown streamed';
_streamDiv.innerHTML = '<span class="cursor"></span>'; _streamDiv.innerHTML = '<p><span class="cursor"></span></p>';
_streamText = ''; _streamText = '';
chatEl().appendChild(_streamDiv); chatEl().appendChild(_streamDiv);
scrollDown(); scrollDown();
@@ -131,9 +131,15 @@ function appendToStream(text) {
if (!_streamDiv) startStreamBubble(); if (!_streamDiv) startStreamBubble();
_streamText += text; _streamText += text;
_streamDiv.innerHTML = renderMarkdown(_streamText); _streamDiv.innerHTML = renderMarkdown(_streamText);
// Cursor ins letzte Inline/Text-Element einfügen, damit er nicht auf eine neue Zeile rutscht
const cursor = document.createElement('span'); const cursor = document.createElement('span');
cursor.className = 'cursor'; cursor.className = 'cursor';
_streamDiv.appendChild(cursor); const lastBlock = _streamDiv.lastElementChild;
if (lastBlock) {
lastBlock.appendChild(cursor);
} else {
_streamDiv.appendChild(cursor);
}
scrollDown(); scrollDown();
} }