feat: implement answer-limited state handling in voice stream service

- 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.
This commit is contained in:
PeymanHonarjoo
2026-10-12 16:51:04 +03:30
parent 0af55f52a3
commit 9e8dd33927
11 changed files with 1505 additions and 29 deletions
@@ -48,12 +48,43 @@
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;
@@ -77,7 +108,7 @@
.source-chip {
display: flex;
align-items: baseline;
align-items: flex-start;
gap: 0.375rem;
padding: 0.25rem 0.5rem;
border: 1px solid var(--surface-border);
@@ -85,7 +116,7 @@
background: var(--surface-bg);
color: var(--text-secondary);
font-size: 0.75rem;
line-height: 1.5;
line-height: 1.6;
}
.source-chip.is-unavailable {
@@ -103,6 +134,15 @@
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;