Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix auth in edit_agent evals (#37869)

Ben Brandt5e58f44d85fb
diff --git a/crates/assistant_tools/src/edit_agent/evals.rs b/crates/assistant_tools/src/edit_agent/evals.rs
index e78d43f56b2..515e22d5f8b 100644
--- a/crates/assistant_tools/src/edit_agent/evals.rs
+++ b/crates/assistant_tools/src/edit_agent/evals.rs
@@ -1520,7 +1520,15 @@ impl EditAgentTest {
selected_model: &SelectedModel,
cx: &mut AsyncApp,
) -> Result<Arc<dyn LanguageModel>> {
- let (provider, model) = cx.update(|cx| {
+ cx.update(|cx| {
+ let registry = LanguageModelRegistry::read_global(cx);
+ let provider = registry
+ .provider(&selected_model.provider)
+ .expect("Provider not found");
+ provider.authenticate(cx)
+ })?
+ .await?;
+ cx.update(|cx| {
let models = LanguageModelRegistry::read_global(cx);
let model = models
.available_models(cx)
@@ -1529,11 +1537,8 @@ impl EditAgentTest {
&& model.id() == selected_model.model
})
.expect("Model not found");
- let provider = models.provider(&model.provider_id()).unwrap();
- (provider, model)
- })?;
- cx.update(|cx| provider.authenticate(cx))?.await?;
- Ok(model)
+ model
+ })
}
async fn eval(&self, eval: EvalInput, cx: &mut TestAppContext) -> Result<EvalOutput> {