(raw: Option<&str>)
| 527 | } |
| 528 | |
| 529 | fn parse_model_string(raw: Option<&str>) -> Option<(String, String)> { |
| 530 | let raw = raw?.trim(); |
| 531 | if raw.is_empty() { |
| 532 | return None; |
| 533 | } |
| 534 | |
| 535 | let (provider, model) = raw.split_once(':').or_else(|| raw.split_once('/'))?; |
| 536 | |
| 537 | if provider.is_empty() || model.is_empty() { |
| 538 | return None; |
| 539 | } |
| 540 | |
| 541 | Some((provider.to_string(), model.to_string())) |
| 542 | } |
| 543 | |
| 544 | #[cfg(test)] |
| 545 | mod tests { |