Skip to content

Commit caa2ed4

Browse files
committed
Improve streaming content layout and spinner positioning
Updated `Ask.razor` to conditionally apply a CSS class for the `streaming-text` div based on message status, enabling a spinner display during streaming. Adjusted spinner position from bottom right to bottom left and ensured proper layout with a minimum height for `streaming-content`. Modified a comment for clarity regarding the `Citations` property. In `Ask.razor.css`, added padding to `streaming-text` for spinner accommodation and adjusted spinner styling to maintain layout integrity.
1 parent d8343b1 commit caa2ed4

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

SqlDatabaseVectorSearch/Components/Pages/Ask.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
<div class="card card-text d-inline-block p-2 px-3 m-1">
5050
<div class="message-content">
5151
<div class="streaming-content">
52-
<div class="streaming-text">
52+
<div class="streaming-text @(message.Status == MessageStatus.Streaming ? "streaming-text-with-spinner" : "")">
5353
<Markdown style="overflow-y:auto;">@message.Text</Markdown>
5454
</div>
5555
@if (message.Status == MessageStatus.Streaming)
5656
{
57-
<div class="streaming-spinner-bottom-right">
57+
<div class="streaming-spinner-bottom-left">
5858
<Spinner Size="SpinnerSize.Small" Color="SpinnerColor.Primary" />
5959
</div>
6060
}
@@ -327,7 +327,7 @@
327327

328328
public string? TokenUsage { get; set; }
329329

330-
// List of citations extracted from the answer
330+
// List of citations extracted from the answer.
331331
public IEnumerable<Citation>? Citations { get; set; }
332332
}
333333

SqlDatabaseVectorSearch/Components/Pages/Ask.razor.css

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,23 @@ input[type="checkbox"] + label {
8282
}
8383

8484
.streaming-content {
85-
display: flex;
86-
align-items: flex-end;
87-
gap: 8px;
85+
position: relative;
8886
min-height: 1.5em;
8987
}
9088

9189
.streaming-text {
92-
flex: 1;
93-
min-width: 0;
90+
/* Add padding to make space for the spinner when streaming */
91+
}
92+
93+
.streaming-text-with-spinner {
94+
padding-bottom: 28px; /* Space for spinner (16px height + 8px margin + 4px extra) */
9495
}
9596

96-
.streaming-spinner-bottom-right {
97-
flex-shrink: 0;
98-
align-self: flex-end;
97+
.streaming-spinner-bottom-left {
98+
position: absolute;
99+
bottom: 2px;
100+
left: 0px;
101+
z-index: 10;
99102
}
100103

101104
.btn-clipboard {

0 commit comments

Comments
 (0)