MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / parse_model_string

Function parse_model_string

crates/opencode-agent/src/executor.rs:529–542  ·  view source on GitHub ↗
(raw: Option<&str>)

Source from the content-addressed store, hash-verified

527}
528
529fn 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)]
545mod tests {

Calls 1

is_emptyMethod · 0.80