(
input: &Bound<'_, PyAny>,
history: Option<&Bound<'_, PyList>>,
)
| 6460 | } |
| 6461 | |
| 6462 | fn py_session_input_to_parts( |
| 6463 | input: &Bound<'_, PyAny>, |
| 6464 | history: Option<&Bound<'_, PyList>>, |
| 6465 | ) -> PyResult<( |
| 6466 | String, |
| 6467 | Option<Vec<RustMessage>>, |
| 6468 | Vec<a3s_code_core::llm::Attachment>, |
| 6469 | )> { |
| 6470 | if let Ok(prompt) = input.extract::<String>() { |
| 6471 | let rust_history = history.map(py_list_to_messages).transpose()?; |
| 6472 | return Ok((prompt, rust_history, Vec::new())); |
| 6473 | } |
| 6474 | |
| 6475 | if let Ok(request) = input.downcast::<PyDict>() { |
| 6476 | return py_session_request_to_parts(request); |
| 6477 | } |
| 6478 | |
| 6479 | Err(PyTypeError::new_err( |
| 6480 | "session input must be a prompt string or request dict", |
| 6481 | )) |
| 6482 | } |
| 6483 | |
| 6484 | /// Convert a Python list of message dicts to `Vec<RustMessage>`. |
| 6485 | /// |
no test coverage detected