(&mut self, os: &mut Os)
| 3450 | } |
| 3451 | |
| 3452 | async fn retry_model_overload(&mut self, os: &mut Os) -> Result<ChatState, ChatError> { |
| 3453 | os.client.invalidate_model_cache().await; |
| 3454 | match select_model(os, self).await { |
| 3455 | Ok(Some(_)) => (), |
| 3456 | Ok(None) => { |
| 3457 | // User did not select a model, so reset the current request state. |
| 3458 | self.conversation.enforce_conversation_invariants(); |
| 3459 | self.conversation.reset_next_user_message(); |
| 3460 | self.pending_tool_index = None; |
| 3461 | self.tool_turn_start_time = None; |
| 3462 | return Ok(ChatState::PromptUser { |
| 3463 | skip_printing_tools: false, |
| 3464 | }); |
| 3465 | }, |
| 3466 | Err(err) => return Err(err), |
| 3467 | } |
| 3468 | |
| 3469 | if self.interactive { |
| 3470 | self.spinner = Some(Spinner::new(Spinners::Dots, "Thinking...".to_owned())); |
| 3471 | } |
| 3472 | |
| 3473 | Ok(ChatState::HandleResponseStream( |
| 3474 | self.conversation |
| 3475 | .as_sendable_conversation_state(os, &mut self.stderr, true) |
| 3476 | .await?, |
| 3477 | )) |
| 3478 | } |
| 3479 | |
| 3480 | /// Apply program context to tools that Q may not have. |
| 3481 | // We cannot attach this any other way because Tools are constructed by deserializing |
nothing calls this directly
no test coverage detected