From 8343987bf80eb1bcdc4af1ce9a7bccdd78d91c5a Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 03:45:28 +0000 Subject: [PATCH] Revert "Remove VS Code references from Copilot integration" (#48555) (cherry-pick to preview) (#48557) Cherry-pick of #48555 to preview ---- Reverts zed-industries/zed#48528 Release Notes: - N/A Co-authored-by: Mikayla Maki --- crates/copilot_chat/src/copilot_chat.rs | 55 +++++++++++-------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/crates/copilot_chat/src/copilot_chat.rs b/crates/copilot_chat/src/copilot_chat.rs index 7f18e597ce0336d45a0d1183217e7863e6b0c223..56b844ea6bc704a2fb5065222f4c356ecbeded5a 100644 --- a/crates/copilot_chat/src/copilot_chat.rs +++ b/crates/copilot_chat/src/copilot_chat.rs @@ -704,31 +704,19 @@ async fn get_models( Ok(models) } -fn copilot_request_headers(builder: http_client::Builder, api_token: &str) -> http_client::Builder { - builder - .header("Authorization", format!("Bearer {}", api_token)) - .header("Content-Type", "application/json") - .header( - "Editor-Version", - format!( - "Zed/{}", - option_env!("CARGO_PKG_VERSION").unwrap_or("unknown") - ), - ) -} - async fn request_models( models_url: Arc, api_token: String, client: Arc, ) -> Result> { - let request_builder = copilot_request_headers( - HttpRequest::builder() - .method(Method::GET) - .uri(models_url.as_ref()), - &api_token, - ) - .header("x-github-api-version", "2025-05-01"); + let request_builder = HttpRequest::builder() + .method(Method::GET) + .uri(models_url.as_ref()) + .header("Authorization", format!("Bearer {}", api_token)) + .header("Content-Type", "application/json") + .header("Copilot-Integration-Id", "vscode-chat") + .header("Editor-Version", "vscode/1.103.2") + .header("x-github-api-version", "2025-05-01"); let request = request_builder.body(AsyncBody::empty())?; @@ -816,16 +804,23 @@ async fn stream_completion( let request_initiator = if is_user_initiated { "user" } else { "agent" }; - let request_builder = copilot_request_headers( - HttpRequest::builder() - .method(Method::POST) - .uri(completion_url.as_ref()), - &api_key, - ) - .header("X-Initiator", request_initiator) - .when(is_vision_request, |builder| { - builder.header("Copilot-Vision-Request", is_vision_request.to_string()) - }); + let request_builder = HttpRequest::builder() + .method(Method::POST) + .uri(completion_url.as_ref()) + .header( + "Editor-Version", + format!( + "Zed/{}", + option_env!("CARGO_PKG_VERSION").unwrap_or("unknown") + ), + ) + .header("Authorization", format!("Bearer {}", api_key)) + .header("Content-Type", "application/json") + .header("Copilot-Integration-Id", "vscode-chat") + .header("X-Initiator", request_initiator) + .when(is_vision_request, |builder| { + builder.header("Copilot-Vision-Request", is_vision_request.to_string()) + }); let is_streaming = request.stream;