mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 13:30:26 +01:00
edit_prediction: Route edit prediction rating through Cloud (#49385)
This PR updates the `Edit Prediction Rated` event to be routed through Cloud instead of the normal telemetry pipeline. Closes CLO-224. Release Notes: - N/A --------- Co-authored-by: Tom <tom@zed.dev>
This commit is contained in:
@@ -206,6 +206,34 @@ impl CloudApiClient {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn submit_edit_prediction_feedback(
|
||||
&self,
|
||||
body: SubmitEditPredictionFeedbackBody,
|
||||
) -> Result<()> {
|
||||
let request = self.build_request(
|
||||
Request::builder().method(Method::POST).uri(
|
||||
self.http_client
|
||||
.build_zed_cloud_url("/client/feedback/edit_prediction")?
|
||||
.as_ref(),
|
||||
),
|
||||
AsyncBody::from(serde_json::to_string(&body)?),
|
||||
)?;
|
||||
|
||||
let mut response = self.http_client.send(request).await?;
|
||||
|
||||
if !response.status().is_success() {
|
||||
let mut body = String::new();
|
||||
response.body_mut().read_to_string(&mut body).await?;
|
||||
|
||||
anyhow::bail!(
|
||||
"Failed to submit edit prediction feedback.\nStatus: {:?}\nBody: {body}",
|
||||
response.status()
|
||||
)
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn build_request(
|
||||
|
||||
Reference in New Issue
Block a user