Remove individual URL overrides for LLM service (#30290)

This PR removes the individual URL overrides for the LLM service.

We initially had `ZED_PREDICT_EDITS_URL` to allow for directing traffic
to the LLM Worker back when there was still the split of the
Collab-based LLM Service and the Cloudflare-based LLM Worker.

But now that all of the LLM functionality has been moved into the
Worker, we can just direct all traffic there.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-08 13:54:46 -04:00 committed by GitHub
parent c64dc82e21
commit f21780cef3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 39 deletions

View file

@ -231,7 +231,7 @@ impl HttpClientWithUrl {
let base_api_url = match base_url.as_ref() { let base_api_url = match base_url.as_ref() {
"https://zed.dev" => "https://llm.zed.dev", "https://zed.dev" => "https://llm.zed.dev",
"https://staging.zed.dev" => "https://llm-staging.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, other => other,
}; };

View file

@ -540,13 +540,9 @@ impl CloudLanguageModel {
let mut retry_delay = Duration::from_secs(1); let mut retry_delay = Duration::from_secs(1);
loop { loop {
let request_builder = http_client::Request::builder().method(Method::POST); let request_builder = http_client::Request::builder()
let request_builder = if let Ok(completions_url) = std::env::var("ZED_COMPLETIONS_URL") .method(Method::POST)
{ .uri(http_client.build_zed_llm_url("/completions", &[])?.as_ref());
request_builder.uri(completions_url)
} else {
request_builder.uri(http_client.build_zed_llm_url("/completions", &[])?.as_ref())
};
let request_builder = if let Some(app_version) = app_version { let request_builder = if let Some(app_version) = app_version {
request_builder.header(ZED_VERSION_HEADER_NAME, app_version.to_string()) request_builder.header(ZED_VERSION_HEADER_NAME, app_version.to_string())
} else { } else {
@ -743,17 +739,6 @@ impl LanguageModel for CloudLanguageModel {
let http_client = &client.http_client(); let http_client = &client.http_client();
let token = llm_api_token.acquire(&client).await?; 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 { let request_body = CountTokensBody {
provider: zed_llm_client::LanguageModelProvider::Google, provider: zed_llm_client::LanguageModelProvider::Google,
model: model_id, model: model_id,
@ -761,7 +746,13 @@ impl LanguageModel for CloudLanguageModel {
generate_content_request, 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("Content-Type", "application/json")
.header("Authorization", format!("Bearer {token}")) .header("Authorization", format!("Bearer {token}"))
.body(serde_json::to_string(&request_body)?.into())?; .body(serde_json::to_string(&request_body)?.into())?;

View file

@ -77,13 +77,9 @@ async fn perform_web_search(
let token = llm_api_token.acquire(&client).await?; let token = llm_api_token.acquire(&client).await?;
let request_builder = http_client::Request::builder().method(Method::POST); let request = http_client::Request::builder()
let request_builder = if let Ok(web_search_url) = std::env::var("ZED_WEB_SEARCH_URL") { .method(Method::POST)
request_builder.uri(web_search_url) .uri(http_client.build_zed_llm_url("/web_search", &[])?.as_ref())
} else {
request_builder.uri(http_client.build_zed_llm_url("/web_search", &[])?.as_ref())
};
let request = request_builder
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {token}")) .header("Authorization", format!("Bearer {token}"))
.header(CLIENT_SUPPORTS_EXA_WEB_SEARCH_PROVIDER_HEADER_NAME, "true") .header(CLIENT_SUPPORTS_EXA_WEB_SEARCH_PROVIDER_HEADER_NAME, "true")

View file

@ -740,18 +740,13 @@ and then another
let mut did_retry = false; let mut did_retry = false;
loop { loop {
let request_builder = http_client::Request::builder().method(Method::POST); let request = http_client::Request::builder()
let request_builder = .method(Method::POST)
if let Ok(predict_edits_url) = std::env::var("ZED_PREDICT_EDITS_URL") { .uri(
request_builder.uri(predict_edits_url) http_client
} else { .build_zed_llm_url("/predict_edits/v2", &[])?
request_builder.uri( .as_ref(),
http_client )
.build_zed_llm_url("/predict_edits/v2", &[])?
.as_ref(),
)
};
let request = request_builder
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {}", token)) .header("Authorization", format!("Bearer {}", token))
.header(ZED_VERSION_HEADER_NAME, app_version.to_string()) .header(ZED_VERSION_HEADER_NAME, app_version.to_string())