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

Function load_models_dev_data

crates/opencode-server/src/routes.rs:2176–2193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2174 OnceCell::const_new();
2175
2176async fn load_models_dev_data() -> ModelsData {
2177 let cache_path = dirs::cache_dir()
2178 .unwrap_or_else(std::env::temp_dir)
2179 .join("opencode")
2180 .join("models.json");
2181
2182 if let Ok(content) = tokio::fs::read_to_string(&cache_path).await {
2183 if let Ok(parsed) = serde_json::from_str::<ModelsData>(&content) {
2184 return parsed;
2185 }
2186 }
2187
2188 let registry = ModelsRegistry::default();
2189 match tokio::time::timeout(Duration::from_secs(2), registry.get()).await {
2190 Ok(data) => data,
2191 Err(_) => HashMap::new(),
2192 }
2193}
2194
2195fn build_model_variant_lookup(data: ModelsData) -> HashMap<String, HashMap<String, Vec<String>>> {
2196 data.into_iter()

Callers 1

get_model_variant_lookupFunction · 0.85

Calls 2

newFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected