MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / select_model

Function select_model

crates/opencode-cli/src/main.rs:1647–1661  ·  view source on GitHub ↗
(
    _executor: &mut AgentExecutor,
    model_id: &str,
    registry: &ProviderRegistry,
)

Source from the content-addressed store, hash-verified

1645}
1646
1647fn select_model(
1648 _executor: &mut AgentExecutor,
1649 model_id: &str,
1650 registry: &ProviderRegistry,
1651) -> anyhow::Result<()> {
1652 let model = registry
1653 .list()
1654 .iter()
1655 .flat_map(|p| p.models())
1656 .find(|m| m.id == model_id)
1657 .ok_or_else(|| anyhow::anyhow!("Model not found: {}", model_id))?;
1658
1659 println!("Selected model: {} ({})\n", model_id, model.name);
1660 Ok(())
1661}
1662
1663const DEFAULT_PLUGIN_SERVER_URL: &str = "http://127.0.0.1:4096";
1664

Callers 1

run_chat_sessionFunction · 0.85

Calls 3

findMethod · 0.80
listMethod · 0.45
modelsMethod · 0.45

Tested by

no test coverage detected