This PR makes it so the pending completion is cleared when an error occurs. This makes it so `Thread::is_streaming()` will return `false` in the error case (and thus hide the streaming indicator in the UI). Release Notes: - N/A
Unified · Split
| @@ -361,7 +361,7 @@ impl Thread { · 360 unmodified lines | |||
| 361 | let result = stream_completion.await; | 361 | let result = stream_completion.await; |
| 362 | 362 | ||
| 363 | thread | 363 | thread |
| 364 | .update(&mut cx, |_thread, cx| match result.as_ref() { | 364 | .update(&mut cx, |thread, cx| match result.as_ref() { |
| 365 | Ok(stop_reason) => match stop_reason { | 365 | Ok(stop_reason) => match stop_reason { |
| 366 | StopReason::ToolUse => { | 366 | StopReason::ToolUse => { |
| 367 | cx.emit(ThreadEvent::UsePendingTools); | 367 | cx.emit(ThreadEvent::UsePendingTools); |
| @@ -384,6 +384,8 @@ impl Thread { · 16 unmodified lines | |||
| 384 | SharedString::from(error_message.clone()), | 384 | SharedString::from(error_message.clone()), |
| 385 | ))); | 385 | ))); |
| 386 | } | 386 | } |
| 387 | |||
| 388 | thread.cancel_last_completion(); | ||
| 387 | } | 389 | } |
| 388 | }) | 390 | }) |
| 389 | .ok(); | 391 | .ok(); |