diff --git a/crates/edit_prediction/src/edit_prediction_tests.rs b/crates/edit_prediction/src/edit_prediction_tests.rs index cc3bb84808981fd1430f9e71aa796e590cc78169..b34ff6fce71fe7afcaff68121510f48f6f8f98c4 100644 --- a/crates/edit_prediction/src/edit_prediction_tests.rs +++ b/crates/edit_prediction/src/edit_prediction_tests.rs @@ -1848,6 +1848,7 @@ async fn test_edit_prediction_basic_interpolation(cx: &mut TestAppContext) { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }, buffer_snapshotted_at: Instant::now(), response_received_at: Instant::now(), diff --git a/crates/edit_prediction/src/fim.rs b/crates/edit_prediction/src/fim.rs index d3e18f73acc665eec28d725530d11297cf4d69ea..02053aae7154acdfa22a01a4f84d6b732a9ca696 100644 --- a/crates/edit_prediction/src/fim.rs +++ b/crates/edit_prediction/src/fim.rs @@ -85,6 +85,7 @@ pub fn request_prediction( experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; let prefix = inputs.cursor_excerpt[..inputs.cursor_offset_in_excerpt].to_string(); diff --git a/crates/edit_prediction/src/mercury.rs b/crates/edit_prediction/src/mercury.rs index bf9b43d528db1717f54143e4805e41aefc81f64a..f61219e2f71d5efbb2fb67250b58b0a5a090e9a8 100644 --- a/crates/edit_prediction/src/mercury.rs +++ b/crates/edit_prediction/src/mercury.rs @@ -112,6 +112,7 @@ impl Mercury { }, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; let prompt = build_prompt(&inputs); diff --git a/crates/edit_prediction/src/prediction.rs b/crates/edit_prediction/src/prediction.rs index 0dd33c03a95d77ec680d47d96daa8e6a44f51b62..263409043b397e2df1ac32514a0ce76656fbefe1 100644 --- a/crates/edit_prediction/src/prediction.rs +++ b/crates/edit_prediction/src/prediction.rs @@ -165,6 +165,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }, buffer_snapshotted_at: Instant::now(), response_received_at: Instant::now(), diff --git a/crates/edit_prediction/src/sweep_ai.rs b/crates/edit_prediction/src/sweep_ai.rs index d88a159a47aa7633a5b064e72a75dd61604710e1..d8ce180801aa8902bfff79044cabaae7570ed05f 100644 --- a/crates/edit_prediction/src/sweep_ai.rs +++ b/crates/edit_prediction/src/sweep_ai.rs @@ -229,6 +229,7 @@ impl SweepAi { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; send_started_event( diff --git a/crates/edit_prediction/src/zeta.rs b/crates/edit_prediction/src/zeta.rs index ccb058e1193eaf2919c286c6e675a907e4af159f..3397d31276efcc7e1d68336f87ccf3e035f51f3a 100644 --- a/crates/edit_prediction/src/zeta.rs +++ b/crates/edit_prediction/src/zeta.rs @@ -64,6 +64,18 @@ pub fn request_prediction_with_zeta( .map(|file| -> Arc { file.full_path(cx).into() }) .unwrap_or_else(|| Arc::from(Path::new("untitled"))); + let repo_url = if can_collect_data { + let buffer_id = buffer.read(cx).remote_id(); + project + .read(cx) + .git_store() + .read(cx) + .repository_and_path_for_buffer_id(buffer_id, cx) + .and_then(|(repo, _)| repo.read(cx).default_remote_url()) + } else { + None + }; + let client = store.client.clone(); let llm_token = store.llm_token.clone(); let organization_id = store @@ -91,6 +103,7 @@ pub fn request_prediction_with_zeta( preferred_experiment, is_open_source, can_collect_data, + repo_url, ); if prompt_input_contains_special_tokens(&prompt_input, zeta_version) { @@ -391,6 +404,7 @@ pub fn zeta2_prompt_input( preferred_experiment: Option, is_open_source: bool, can_collect_data: bool, + repo_url: Option, ) -> (Range, zeta_prompt::ZetaPromptInput) { let cursor_point = cursor_offset.to_point(snapshot); @@ -422,6 +436,7 @@ pub fn zeta2_prompt_input( experiment: preferred_experiment, in_open_source_repo: is_open_source, can_collect_data, + repo_url, }; (full_context_offset_range, prompt_input) } diff --git a/crates/edit_prediction_cli/src/load_project.rs b/crates/edit_prediction_cli/src/load_project.rs index dcf417c2e8cc70dfcaffdf4b96dbe3b17daa61d4..df458770519be5accd72f33a56893bb13c9b88a9 100644 --- a/crates/edit_prediction_cli/src/load_project.rs +++ b/crates/edit_prediction_cli/src/load_project.rs @@ -105,6 +105,7 @@ pub async fn run_load_project( in_open_source_repo: false, can_collect_data: false, experiment: None, + repo_url: None, }, language_name, ) diff --git a/crates/edit_prediction_cli/src/reversal_tracking.rs b/crates/edit_prediction_cli/src/reversal_tracking.rs index 2d578c8666f217365ed2ed24ff766ed6f19566d7..cb955dbdf7dd2375395e8c0ecd52df849e33fb38 100644 --- a/crates/edit_prediction_cli/src/reversal_tracking.rs +++ b/crates/edit_prediction_cli/src/reversal_tracking.rs @@ -681,6 +681,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, } } diff --git a/crates/zeta_prompt/src/zeta_prompt.rs b/crates/zeta_prompt/src/zeta_prompt.rs index 2ec12e8bebb4a868c0784e2fe52541a1de580555..d1cb24a8c83710e06d04e0c006a1963882982f59 100644 --- a/crates/zeta_prompt/src/zeta_prompt.rs +++ b/crates/zeta_prompt/src/zeta_prompt.rs @@ -61,6 +61,8 @@ pub struct ZetaPromptInput { pub in_open_source_repo: bool, #[serde(default)] pub can_collect_data: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repo_url: Option, } #[derive( @@ -2715,6 +2717,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, } } @@ -3312,6 +3315,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; let prompt = zeta1::format_zeta1_from_input(&input, 15..41, 0..excerpt.len()); @@ -3374,6 +3378,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; let prompt = zeta1::format_zeta1_from_input(&input, 0..28, 0..28); @@ -3431,6 +3436,7 @@ mod tests { experiment: None, in_open_source_repo: false, can_collect_data: false, + repo_url: None, }; let prompt = zeta1::format_zeta1_from_input(&input, editable_range, context_range);