Files
faq_chatbot_frontend/src/app/shared/ui/voice-transcript/voice-transcript.component.html
T
PeymanHonarjoo 9e8dd33927 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.
2026-10-12 16:51:04 +03:30

45 lines
1.9 KiB
HTML

@for (message of messages(); track message.role + message.id) {
<div class="bubble-row" [class.is-user]="message.role === 'user'">
<div
class="bubble"
[class.is-user]="message.role === 'user'"
[class.is-partial]="!message.final"
[class.is-interrupted]="message.interrupted"
[class.is-limited]="message.limited && !message.interrupted"
dir="rtl"
>
@if (message.text) {
<span class="bubble-text">{{ message.text }}</span>
} @else if (message.limited && !message.interrupted) {
<!-- A limited answer with no transcript text: never manufacture spoken text. -->
<span class="bubble-text is-missing">متن این پاسخ در دسترس نیست</span>
}
@if (message.interrupted) {
<span class="bubble-tag">(قطع شد)</span>
} @else if (message.limited) {
<!-- Informational answer state: the answer is limited, not a failure and not complete. -->
<span class="bubble-footer">
<span class="bubble-tag is-limited">پاسخ محدود شده</span>
<span class="bubble-help">برای توضیح بیشتر بگویید «ادامه بده».</span>
</span>
}
@if (message.sources?.length) {
<ul class="source-list" aria-label="منابع پاسخ">
@for (source of message.sources ?? []; track source.source_ref + source.chunk_id) {
<li
class="source-chip"
[class.is-unavailable]="source.available === false"
[attr.title]="sourceTooltip(source)"
>
<span class="source-ref">{{ source.source_ref }}</span>
<span class="source-label">{{ sourceLabel(source) }}</span>
</li>
}
</ul>
}
</div>
</div>
} @empty {
<p class="transcript-empty">صحبت کنید؛ گفتگو اینجا نمایش داده می‌شود</p>
}