From dfaf270f83625b09f7ec25256c0862eb8660a2f3 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Mon, 12 Oct 2026 10:54:04 -0700
Subject: [PATCH] Tweak cursor, make sources appear after its done streaming
---
.../components/chat/chat/chat.component.html | 5 ++---
.../components/chat/chat/chat.component.scss | 21 ++++++++++++-------
.../chat/chat/chat.component.spec.ts | 7 +++++++
3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src-ui/src/app/components/chat/chat/chat.component.html b/src-ui/src/app/components/chat/chat/chat.component.html
index 78a1626f7..eb4f8cb01 100644
--- a/src-ui/src/app/components/chat/chat/chat.component.html
+++ b/src-ui/src/app/components/chat/chat/chat.component.html
@@ -37,12 +37,11 @@
}
} @else if (message.role === 'assistant') {
-
- @if (message.isStreaming) { | }
+
} @else {
{{ message.content }}
}
- @if (message.role === 'assistant' && message.references?.length) {
+ @if (message.role === 'assistant' && !message.isStreaming && message.references?.length) {
Sources
@for (reference of message.references; track reference.id) {
diff --git a/src-ui/src/app/components/chat/chat/chat.component.scss b/src-ui/src/app/components/chat/chat/chat.component.scss
index 1b6ff99ff..64c373734 100644
--- a/src-ui/src/app/components/chat/chat/chat.component.scss
+++ b/src-ui/src/app/components/chat/chat/chat.component.scss
@@ -22,18 +22,23 @@
}
}
-.blinking-cursor {
- font-weight: bold;
- font-size: 1.2em;
- animation: blink 1s step-end infinite;
+.chat-markdown.streaming ::ng-deep {
+ > :last-child:not(ul, ol, table)::after,
+ > :is(ul, ol):last-child > li:last-child::after {
+ content: '';
+ display: inline-block;
+ width: 2px;
+ height: 1.05em;
+ margin-left: 2px;
+ background-color: currentColor;
+ vertical-align: -0.15em;
+ animation: blink 1s step-end infinite;
+ }
}
@keyframes blink {
- from, to {
- opacity: 0;
- }
50% {
- opacity: 1;
+ opacity: 0;
}
}
diff --git a/src-ui/src/app/components/chat/chat/chat.component.spec.ts b/src-ui/src/app/components/chat/chat/chat.component.spec.ts
index 90052cce0..7bf4129a9 100644
--- a/src-ui/src/app/components/chat/chat/chat.component.spec.ts
+++ b/src-ui/src/app/components/chat/chat/chat.component.spec.ts
@@ -89,6 +89,7 @@ describe('ChatComponent', () => {
expect(component.messages()[1].content).toBe('H')
fixture.detectChanges()
expect(messagesEl.querySelector('.spinner-border')).toBeNull()
+ expect(messagesEl.querySelector('.chat-markdown.streaming')).not.toBeNull()
mockStream$.next('Hi there')
// advance time to process the typewriter effect
await jest.runAllTimersAsync()
@@ -103,6 +104,8 @@ describe('ChatComponent', () => {
await fixture.whenStable()
expect(component.loading()).toBe(false)
expect(component.messages()[1].isStreaming).toBe(false)
+ fixture.detectChanges()
+ expect(messagesEl.querySelector('.chat-markdown.streaming')).toBeNull()
expect(fixture.nativeElement.querySelector('#chatInput').disabled).toBe(
false
)
@@ -130,6 +133,10 @@ describe('ChatComponent', () => {
mockStream$.next(
`Hi there${CHAT_METADATA_DELIMITER}{"references":[{"id":42,"title":"Bread Recipe"}]}`
)
+ fixture.detectChanges()
+ expect(fixture.nativeElement.querySelector('.chat-references')).toBeNull()
+
+ mockStream$.complete()
jest.advanceTimersByTime(1000)
fixture.detectChanges()