- Introduced handling for 'answer_limited' events from the server, allowing the UI to reflect when an assistant's answer has reached the output-token limit. - Updated the VoiceStreamService to manage limited and interrupted turns with bounded memory. - Enhanced the transcript component to display appropriate messages for limited answers, including a fallback for unavailable text. - Added styles to visually indicate limited answers in the UI. - Created unit tests for the new functionality, ensuring correct behavior for limited answers and their presentation.
174 lines
3.1 KiB
CSS
174 lines
3.1 KiB
CSS
:host {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
min-height: 0;
|
|
flex: 1;
|
|
}
|
|
|
|
/* RTL: user bubbles sit on the right (start), assistant text on the left (end). */
|
|
.bubble-row {
|
|
display: flex;
|
|
justify-content: flex-end;
|
|
animation: bubbleIn 0.3s ease;
|
|
}
|
|
|
|
.bubble-row.is-user {
|
|
justify-content: flex-start;
|
|
}
|
|
|
|
/* Assistant: plain text on the page background (chat-style, no bubble). */
|
|
.bubble {
|
|
max-width: 88%;
|
|
padding: 0.125rem 0;
|
|
color: var(--text-primary);
|
|
font-size: 0.9375rem;
|
|
line-height: 1.8;
|
|
text-align: right;
|
|
white-space: pre-wrap;
|
|
overflow-wrap: anywhere;
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
.bubble.is-user {
|
|
max-width: 85%;
|
|
padding: 0.5rem 0.875rem;
|
|
border-radius: 1.125rem;
|
|
background: var(--color-primary);
|
|
color: #ffffff;
|
|
border-end-end-radius: 1.125rem;
|
|
border-end-start-radius: 0.375rem;
|
|
}
|
|
|
|
.bubble.is-partial {
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.bubble.is-interrupted .bubble-text {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.bubble.is-limited {
|
|
/* informational answer state: a quiet accent, never an error treatment */
|
|
border-inline-start: 2px solid var(--color-primary);
|
|
padding-inline-start: 0.5rem;
|
|
}
|
|
|
|
.bubble-tag {
|
|
margin-inline-start: 0.375rem;
|
|
font-size: 0.75rem;
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.bubble-tag.is-limited {
|
|
color: var(--color-primary);
|
|
font-weight: 600;
|
|
opacity: 1;
|
|
}
|
|
|
|
.bubble-footer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 0.125rem;
|
|
margin-top: 0.25rem;
|
|
}
|
|
|
|
.bubble-help {
|
|
font-size: 0.75rem;
|
|
line-height: 1.6;
|
|
color: var(--muted);
|
|
}
|
|
|
|
.bubble-text.is-missing {
|
|
color: var(--muted);
|
|
font-style: italic;
|
|
}
|
|
|
|
@keyframes bubbleIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(8px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
/* ---------- Sources (retrieved documents) ---------- */
|
|
.source-list {
|
|
list-style: none;
|
|
margin: 0.375rem 0 0;
|
|
padding: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.source-chip {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 0.375rem;
|
|
padding: 0.25rem 0.5rem;
|
|
border: 1px solid var(--surface-border);
|
|
border-radius: 0.625rem;
|
|
background: var(--surface-bg);
|
|
color: var(--text-secondary);
|
|
font-size: 0.75rem;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.source-chip.is-unavailable {
|
|
opacity: 0.55;
|
|
text-decoration: line-through;
|
|
}
|
|
|
|
.source-ref {
|
|
flex-shrink: 0;
|
|
padding: 0 0.375rem;
|
|
border-radius: 9999px;
|
|
background: var(--color-primary);
|
|
color: #ffffff;
|
|
font-size: 0.6875rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
/* The excerpt is the chip's content, shown complete with the provider's own line
|
|
breaks — it is the retrieved answer text the user asked to see as the source. */
|
|
.source-label {
|
|
flex: 1 1 auto;
|
|
min-width: 0;
|
|
white-space: pre-wrap;
|
|
overflow-wrap: anywhere;
|
|
}
|
|
|
|
.transcript-empty {
|
|
margin: auto;
|
|
margin-bottom:10px;
|
|
font-size: 0.875rem;
|
|
color: var(--muted);
|
|
text-align: center;
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.bubble-row {
|
|
animation: none !important;
|
|
}
|
|
|
|
.bubble {
|
|
transition: none !important;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 640px) {
|
|
.bubble {
|
|
max-width: 94%;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.bubble.is-user {
|
|
max-width: 92%;
|
|
}
|
|
}
|