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

Method load

crates/opencode-provider/src/models.rs:124–134  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

122 }
123
124 async fn load(&self) -> ModelsData {
125 if let Ok(content) = tokio::fs::read_to_string(&self.cache_path).await {
126 if let Ok(parsed) = serde_json::from_str::<ModelsData>(&content) {
127 let mut data = self.data.write().await;
128 *data = Some(parsed.clone());
129 return parsed;
130 }
131 }
132
133 self.fetch().await
134 }
135
136 async fn fetch(&self) -> ModelsData {
137 let url = format!("{}/api.json", MODELS_DEV_URL);

Callers 1

getMethod · 0.45

Calls 2

cloneMethod · 0.45
fetchMethod · 0.45

Tested by

no test coverage detected