(parts: &[TextPartInput])
| 1975 | } |
| 1976 | |
| 1977 | fn text_from_parts(parts: &[TextPartInput]) -> String { |
| 1978 | parts |
| 1979 | .iter() |
| 1980 | .filter_map(|p| { |
| 1981 | if p.part_type.as_deref() == Some("text") { |
| 1982 | p.text.as_deref() |
| 1983 | } else { |
| 1984 | None |
| 1985 | } |
| 1986 | }) |
| 1987 | .collect::<Vec<_>>() |
| 1988 | .join(" ") |
| 1989 | } |
| 1990 | |
| 1991 | async fn prompt_async( |
| 1992 | State(state): State<Arc<ServerState>>, |