Add feature flag to use cloud.zed.dev instead of llm.zed.dev (#34076)

This PR adds a new `zed-cloud` feature flag that can be used to send
traffic to `cloud.zed.dev` instead of `llm.zed.dev`.

This is just so Zed staff can test the new infrastructure. When we're
ready for prime-time we'll reroute traffic on the server.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-07-08 14:44:51 -04:00 committed by GitHub
parent 01bdef130b
commit 1220049089
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 70 additions and 12 deletions

View file

@ -8,6 +8,7 @@ mod rate_completion_modal;
pub(crate) use completion_diff_element::*;
use db::kvp::KEY_VALUE_STORE;
use feature_flags::{FeatureFlagAppExt as _, ZedCloudFeatureFlag};
pub use init::*;
use inline_completion::DataCollectionState;
use license_detection::LICENSE_FILES_TO_CHECK;
@ -390,6 +391,7 @@ impl Zeta {
let client = self.client.clone();
let llm_token = self.llm_token.clone();
let app_version = AppVersion::global(cx);
let use_cloud = cx.has_flag::<ZedCloudFeatureFlag>();
let buffer = buffer.clone();
@ -480,6 +482,7 @@ impl Zeta {
llm_token,
app_version,
body,
use_cloud,
})
.await;
let (response, usage) = match response {
@ -745,6 +748,7 @@ and then another
llm_token,
app_version,
body,
use_cloud,
..
} = params;
@ -760,7 +764,7 @@ and then another
} else {
request_builder.uri(
http_client
.build_zed_llm_url("/predict_edits/v2", &[])?
.build_zed_llm_url("/predict_edits/v2", &[], use_cloud)?
.as_ref(),
)
};
@ -820,6 +824,7 @@ and then another
let client = self.client.clone();
let llm_token = self.llm_token.clone();
let app_version = AppVersion::global(cx);
let use_cloud = cx.has_flag::<ZedCloudFeatureFlag>();
cx.spawn(async move |this, cx| {
let http_client = client.http_client();
let mut response = llm_token_retry(&llm_token, &client, |token| {
@ -830,7 +835,7 @@ and then another
} else {
request_builder.uri(
http_client
.build_zed_llm_url("/predict_edits/accept", &[])?
.build_zed_llm_url("/predict_edits/accept", &[], use_cloud)?
.as_ref(),
)
};
@ -1126,6 +1131,7 @@ struct PerformPredictEditsParams {
pub llm_token: LlmApiToken,
pub app_version: SemanticVersion,
pub body: PredictEditsBody,
pub use_cloud: bool,
}
#[derive(Error, Debug)]