Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove individual URL overrides for LLM service (#30290)
Marshall Bowersf21780cef3cf
diff --git a/crates/http_client/src/http_client.rs b/crates/http_client/src/http_client.rsindex 6295bddacea..b1f42efc1a5 100644--- a/crates/http_client/src/http_client.rs+++ b/crates/http_client/src/http_client.rs@@ -231,7 +231,7 @@ impl HttpClientWithUrl {let base_api_url = match base_url.as_ref() {"https://zed.dev" => "https://llm.zed.dev","https://staging.zed.dev" => "https://llm-staging.zed.dev",- "http://localhost:3000" => "http://localhost:8080",+ "http://localhost:3000" => "http://localhost:8787",other => other,};diff --git a/crates/language_models/src/provider/cloud.rs b/crates/language_models/src/provider/cloud.rsindex c60b6606b5c..447ef8da88c 100644--- a/crates/language_models/src/provider/cloud.rs+++ b/crates/language_models/src/provider/cloud.rs@@ -540,13 +540,9 @@ impl CloudLanguageModel {let mut retry_delay = Duration::from_secs(1);loop {- let request_builder = http_client::Request::builder().method(Method::POST);- let request_builder = if let Ok(completions_url) = std::env::var("ZED_COMPLETIONS_URL")- {- request_builder.uri(completions_url)- } else {- request_builder.uri(http_client.build_zed_llm_url("/completions", &[])?.as_ref())- };+ let request_builder = http_client::Request::builder()+ .method(Method::POST)+ .uri(http_client.build_zed_llm_url("/completions", &[])?.as_ref());let request_builder = if let Some(app_version) = app_version {request_builder.header(ZED_VERSION_HEADER_NAME, app_version.to_string())} else {@@ -743,17 +739,6 @@ impl LanguageModel for CloudLanguageModel {let http_client = &client.http_client();let token = llm_api_token.acquire(&client).await?;- let request_builder = http_client::Request::builder().method(Method::POST);- let request_builder =- if let Ok(completions_url) = std::env::var("ZED_COUNT_TOKENS_URL") {- request_builder.uri(completions_url)- } else {- request_builder.uri(- http_client- .build_zed_llm_url("/count_tokens", &[])?- .as_ref(),- )- };let request_body = CountTokensBody {provider: zed_llm_client::LanguageModelProvider::Google,model: model_id,@@ -761,7 +746,13 @@ impl LanguageModel for CloudLanguageModel {generate_content_request,})?,};- let request = request_builder+ let request = http_client::Request::builder()+ .method(Method::POST)+ .uri(+ http_client+ .build_zed_llm_url("/count_tokens", &[])?+ .as_ref(),+ ).header("Content-Type", "application/json").header("Authorization", format!("Bearer {token}")).body(serde_json::to_string(&request_body)?.into())?;diff --git a/crates/web_search_providers/src/cloud.rs b/crates/web_search_providers/src/cloud.rsindex 40e03ea00a7..2ac9734797e 100644--- a/crates/web_search_providers/src/cloud.rs+++ b/crates/web_search_providers/src/cloud.rs@@ -77,13 +77,9 @@ async fn perform_web_search(let token = llm_api_token.acquire(&client).await?;- let request_builder = http_client::Request::builder().method(Method::POST);- let request_builder = if let Ok(web_search_url) = std::env::var("ZED_WEB_SEARCH_URL") {- request_builder.uri(web_search_url)- } else {- request_builder.uri(http_client.build_zed_llm_url("/web_search", &[])?.as_ref())- };- let request = request_builder+ let request = http_client::Request::builder()+ .method(Method::POST)+ .uri(http_client.build_zed_llm_url("/web_search", &[])?.as_ref()).header("Content-Type", "application/json").header("Authorization", format!("Bearer {token}")).header(CLIENT_SUPPORTS_EXA_WEB_SEARCH_PROVIDER_HEADER_NAME, "true")diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rsindex eb82e97ec1c..16a5e817930 100644--- a/crates/zeta/src/zeta.rs+++ b/crates/zeta/src/zeta.rs@@ -740,18 +740,13 @@ and then anotherlet mut did_retry = false;loop {- let request_builder = http_client::Request::builder().method(Method::POST);- let request_builder =- if let Ok(predict_edits_url) = std::env::var("ZED_PREDICT_EDITS_URL") {- request_builder.uri(predict_edits_url)- } else {- request_builder.uri(- http_client- .build_zed_llm_url("/predict_edits/v2", &[])?- .as_ref(),- )- };- let request = request_builder+ let request = http_client::Request::builder()+ .method(Method::POST)+ .uri(+ http_client+ .build_zed_llm_url("/predict_edits/v2", &[])?+ .as_ref(),+ ).header("Content-Type", "application/json").header("Authorization", format!("Bearer {}", token)).header(ZED_VERSION_HEADER_NAME, app_version.to_string())