All blocks
Block
System notice + retry
The error-and-recover lane. A failed stream surfaces a system-message, stream-controls switches to Try again, and once we recover, a feedback-bar prompts for a rating.
Error → retry → feedback
Stream failed: upstream timeout after 30s.
Phase:error
@switch (phase()) {
@case ('error') {
<pk-system-message
text="Stream failed: upstream timeout after 30s."
variant="error" [fill]="true"
ctaLabel="Details"
(ctaClicked)="showDetails()"
/>
<pk-stream-controls state="error" (regenerate)="retry()" />
}
@case ('recovering') {
<pk-system-message
text="Retrying with the same prompt..."
variant="action" [fill]="true"
/>
<pk-stream-controls state="streaming" (stop)="abort()" />
}
@case ('recovered') {
<pk-system-message text="Response delivered." variant="action" />
<pk-feedback-bar
title="How was that response after the retry?"
(helpful)="rate('helpful')"
(notHelpful)="rate('not-helpful')"
(closed)="showFeedback.set(false)"
/>
}
}
// Component
type Phase = 'error' | 'recovering' | 'recovered';
protected readonly phase = signal<Phase>('error');
protected retry(): void {
this.phase.set('recovering');
setTimeout(() => this.phase.set('recovered'), 1500);
}