mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
ui(stream): show reconnecting spinner and surface init failures
This commit is contained in:
@@ -6082,6 +6082,12 @@ async fn try_run_turn(
|
||||
Ok(stream) => stream,
|
||||
Err(e) => {
|
||||
turn_latency_guard.mark_failed(Some(format!("stream_init_failed: {e}")));
|
||||
sess
|
||||
.notify_stream_error(
|
||||
&sub_id,
|
||||
format!("[transport] failed to start stream: {e}"),
|
||||
)
|
||||
.await;
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -488,6 +488,9 @@ impl ChatComposer {
|
||||
|| lower.contains("stream error")
|
||||
|| lower.contains("stream closed")
|
||||
|| lower.contains("timeout")
|
||||
|| lower.contains("transport")
|
||||
|| lower.contains("network")
|
||||
|| lower.contains("connection")
|
||||
{
|
||||
"Reconnecting".to_string()
|
||||
}
|
||||
|
||||
@@ -4847,16 +4847,21 @@ impl ChatWidget<'_> {
|
||||
fn mark_reconnecting(&mut self, message: String) {
|
||||
// Keep task running and surface a concise status in the input header.
|
||||
self.bottom_pane.set_task_running(true);
|
||||
self.bottom_pane.update_status_text(message.clone());
|
||||
self.bottom_pane.update_status_text("Reconnecting...".to_string());
|
||||
|
||||
if !self.reconnect_notice_active {
|
||||
self.reconnect_notice_active = true;
|
||||
self.push_background_tail("Connection lost. Auto-retrying…".to_string());
|
||||
self.push_background_tail(format!(
|
||||
"Connection lost. Auto-retrying… ({})",
|
||||
message
|
||||
));
|
||||
}
|
||||
|
||||
// Brief toast so users notice recovery attempts.
|
||||
self.bottom_pane
|
||||
.flash_footer_notice_for("Reconnecting…".to_string(), Duration::from_secs(2));
|
||||
self.bottom_pane.flash_footer_notice_for(
|
||||
format!("Reconnecting… ({})", message),
|
||||
Duration::from_secs(2),
|
||||
);
|
||||
|
||||
// Do NOT clear running state or streams; the retry will resume them.
|
||||
self.request_redraw();
|
||||
|
||||
Reference in New Issue
Block a user