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

Function parse_model_ref

crates/opencode-tool/src/task.rs:230–250  ·  view source on GitHub ↗
(raw: Option<&str>)

Source from the content-addressed store, hash-verified

228}
229
230fn parse_model_ref(raw: Option<&str>) -> AgentModel {
231 let Some(raw) = raw else {
232 return AgentModel {
233 model_id: "default".to_string(),
234 provider_id: "default".to_string(),
235 };
236 };
237
238 let pair = raw.split_once(':').or_else(|| raw.split_once('/'));
239 if let Some((provider, model)) = pair {
240 return AgentModel {
241 model_id: model.to_string(),
242 provider_id: provider.to_string(),
243 };
244 }
245
246 AgentModel {
247 model_id: raw.to_string(),
248 provider_id: "default".to_string(),
249 }
250}
251
252#[cfg(test)]
253mod tests {

Callers 1

executeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected