refactor: overhaul home UI and audio playback reliability
Redesign the home page and voice stream panel into a compact dock layout to improve the chat experience. Implement a flush mechanism in the PCM playback worklet to handle the resampler tail, preventing premature session termination due to phantom outstanding playback. Fix document filter visibility in settings to ensure controls remain accessible when no results match, and refactor transcript insertion to maintain correct user/assistant ordering.
This commit is contained in:
@@ -1,55 +1,27 @@
|
||||
<div
|
||||
class="stream-panel"
|
||||
class="call-dock"
|
||||
role="region"
|
||||
aria-label="گفتگوی صوتی"
|
||||
[class.is-ended]="ended()"
|
||||
[attr.data-state]="state()"
|
||||
>
|
||||
<div class="sr-only" role="status" aria-live="polite">{{ statusText() }}</div>
|
||||
|
||||
<!-- Orb layer: behind the transcript, anchored just above the controls -->
|
||||
<div class="stream-orb-layer" aria-hidden="true">
|
||||
<div class="orb-container" #orbContainer>
|
||||
<div class="dock-row">
|
||||
<div class="orb-container" #orbContainer aria-hidden="true">
|
||||
@if (!orbAvailable()) {
|
||||
<div class="orb-fallback"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="stream-status" [attr.data-state]="state()">
|
||||
<span class="status-dot" aria-hidden="true"></span>
|
||||
<p class="status-text">{{ statusText() }}</p>
|
||||
|
||||
<div class="dock-info" aria-hidden="true">
|
||||
<span class="status-dot" [attr.data-state]="state()"></span>
|
||||
<p class="status-text" [attr.title]="statusText()">{{ statusText() }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Transcript: overlaid on top of the orb, keeps streaming while the call runs -->
|
||||
<div
|
||||
class="stream-transcript"
|
||||
#scroller
|
||||
role="log"
|
||||
aria-label="متن گفتگو"
|
||||
aria-live="polite"
|
||||
aria-relevant="additions"
|
||||
>
|
||||
<app-voice-transcript [messages]="messages()" />
|
||||
</div>
|
||||
|
||||
@if (streamError(); as errorText) {
|
||||
<div class="stream-error" role="alert">
|
||||
<span>{{ errorText }}</span>
|
||||
<button type="button" class="stream-error-close" aria-label="بستن پیام" (click)="dismissError()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="18" x2="6" y1="6" y2="18" />
|
||||
<line x1="6" x2="18" y1="6" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Controls: fade out together with the orb when the call ends -->
|
||||
<div class="stream-footer">
|
||||
<div class="stream-actions">
|
||||
<div class="dock-actions">
|
||||
<button
|
||||
type="button"
|
||||
class="stream-btn"
|
||||
class="dock-btn"
|
||||
[class.is-active]="muted()"
|
||||
[attr.aria-pressed]="muted()"
|
||||
[attr.aria-label]="muteLabel()"
|
||||
@@ -73,16 +45,27 @@
|
||||
<line x1="12" x2="12" y1="19" y2="22" />
|
||||
</svg>
|
||||
}
|
||||
<span>{{ muted() ? 'فعالسازی' : 'بیصدا' }}</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="stream-btn is-end" aria-label="پایان گفتگوی صوتی" (click)="endCall()">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<button type="button" class="dock-btn is-end" aria-label="پایان گفتگوی صوتی" (click)="endCall()">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="18" x2="6" y1="6" y2="18" />
|
||||
<line x1="6" x2="18" y1="6" y2="18" />
|
||||
</svg>
|
||||
<span>پایان گفتگو</span>
|
||||
<span class="dock-btn-label">پایان</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (streamError(); as errorText) {
|
||||
<div class="dock-error" role="alert">
|
||||
<span>{{ errorText }}</span>
|
||||
<button type="button" class="dock-error-close" aria-label="بستن پیام" (click)="dismissError()">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="18" x2="6" y1="6" y2="18" />
|
||||
<line x1="6" x2="18" y1="6" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
Reference in New Issue
Block a user