diff --git a/crates/edit_prediction/src/capture_example.rs b/crates/edit_prediction/src/capture_example.rs index a319c95ec6a501bbca6213a44aa205aba4156f73..33d7d12f1e0eb07ae2e9f13efd7447997c46463a 100644 --- a/crates/edit_prediction/src/capture_example.rs +++ b/crates/edit_prediction/src/capture_example.rs @@ -1,5 +1,5 @@ use crate::{ - EditPredictionExampleCaptureFeatureFlag, StoredEvent, + StoredEvent, cursor_excerpt::editable_and_context_ranges_for_cursor_position, example_spec::{ CapturedEvent, CapturedPromptInput, CapturedRelatedExcerpt, CapturedRelatedFile, @@ -9,15 +9,12 @@ use crate::{ use anyhow::Result; use buffer_diff::BufferDiffSnapshot; use collections::HashMap; -use feature_flags::FeatureFlagAppExt as _; use gpui::{App, Entity, Task}; use language::{Buffer, ToPoint as _}; use project::{Project, WorktreeId}; use std::{collections::hash_map, fmt::Write as _, ops::Range, path::Path, sync::Arc}; use text::{BufferSnapshot as TextBufferSnapshot, Point, ToOffset as _}; -pub(crate) const DEFAULT_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 10; -pub(crate) const DEFAULT_STAFF_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS: u16 = 100; pub(crate) const ZETA2_TESTING_RATE_PER_10K_PREDICTION: u16 = 500; pub fn capture_example( @@ -307,20 +304,6 @@ fn generate_timestamp_name() -> String { } } -pub(crate) fn should_sample_edit_prediction_example_capture(cx: &App) -> bool { - let default_rate = if cx.is_staff() { - DEFAULT_STAFF_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS - } else { - DEFAULT_EXAMPLE_CAPTURE_RATE_PER_10K_PREDICTIONS - }; - let capture_rate = language::language_settings::all_language_settings(None, cx) - .edit_predictions - .example_capture_rate - .unwrap_or(default_rate); - cx.has_flag::() - && rand::random::() % 10_000 < capture_rate -} - pub(crate) fn should_send_testing_zeta2_request() -> bool { rand::random::() % 10_000 < ZETA2_TESTING_RATE_PER_10K_PREDICTION } diff --git a/crates/edit_prediction/src/edit_prediction.rs b/crates/edit_prediction/src/edit_prediction.rs index 6385c6a2b6972740b19fc4009b8b3c241f3cef4e..1c2d756f2797a4f68d0e1fad9ab69b367b278bc9 100644 --- a/crates/edit_prediction/src/edit_prediction.rs +++ b/crates/edit_prediction/src/edit_prediction.rs @@ -72,9 +72,7 @@ pub mod zeta2; #[cfg(test)] mod edit_prediction_tests; -use crate::capture_example::{ - should_sample_edit_prediction_example_capture, should_send_testing_zeta2_request, -}; +use crate::capture_example::should_send_testing_zeta2_request; use crate::license_detection::LicenseDetectionWatcher; use crate::mercury::Mercury; use crate::ollama::Ollama; @@ -115,16 +113,6 @@ impl FeatureFlag for Zeta2FeatureFlag { } } -pub struct EditPredictionExampleCaptureFeatureFlag; - -impl FeatureFlag for EditPredictionExampleCaptureFeatureFlag { - const NAME: &'static str = "edit-prediction-example-capture"; - - fn enabled_for_staff() -> bool { - true - } -} - #[derive(Clone)] struct EditPredictionStoreGlobal(Entity); @@ -1782,33 +1770,6 @@ impl EditPredictionStore { user_actions, }; - let can_collect_example = snapshot - .file() - .is_some_and(|file| self.can_collect_file(&project, file, cx)) - && self.can_collect_events(&inputs.events, cx) - && self.can_collect_related_files(&project, cx); - - if can_collect_example && should_sample_edit_prediction_example_capture(cx) { - let events_for_capture = - self.edit_history_for_project_with_pause_split_last_event(&project, cx); - let related_files_for_capture = inputs.related_files.clone(); - if let Some(example_task) = capture_example::capture_example( - project.clone(), - active_buffer.clone(), - position, - events_for_capture, - related_files_for_capture, - false, - cx, - ) { - cx.spawn(async move |_this, _cx| { - let example = example_task.await?; - telemetry::event!("Edit Prediction Example Captured", example = example); - anyhow::Ok(()) - }) - .detach_and_log_err(cx); - } - } let task = match &self.edit_prediction_model { EditPredictionModel::Zeta1 => { if should_send_testing_zeta2_request() { @@ -2190,21 +2151,6 @@ impl EditPredictionStore { }) } - fn can_collect_related_files(&self, project: &Entity, cx: &mut App) -> bool { - if !self.data_collection_choice.is_enabled(cx) { - return false; - } - - let related_with_buffers = self.context_for_project_with_buffers(project, cx); - - related_with_buffers.iter().all(|(_, buffer)| { - buffer - .read(cx) - .file() - .is_some_and(|file| self.is_file_open_source(project, &file, cx)) - }) - } - fn load_data_collection_choice() -> DataCollectionChoice { let choice = KEY_VALUE_STORE .read_kvp(ZED_PREDICT_DATA_COLLECTION_CHOICE) diff --git a/crates/language/src/language_settings.rs b/crates/language/src/language_settings.rs index 9bb591d82f2e37d0db818d93d5c07d623879d990..f0b21f864fc3c0abf2d51e385b85bd22da5e6522 100644 --- a/crates/language/src/language_settings.rs +++ b/crates/language/src/language_settings.rs @@ -401,7 +401,6 @@ pub struct EditPredictionSettings { /// This setting has no effect if globally disabled. pub enabled_in_text_threads: bool, pub examples_dir: Option>, - pub example_capture_rate: Option, } impl EditPredictionSettings { @@ -745,7 +744,6 @@ impl settings::Settings for AllLanguageSettings { ollama: ollama_settings, enabled_in_text_threads, examples_dir: edit_predictions.examples_dir, - example_capture_rate: edit_predictions.example_capture_rate, }, defaults: default_language_settings, languages, diff --git a/crates/settings_content/src/language.rs b/crates/settings_content/src/language.rs index bf5977bbd6abd3354c9a13480121d3aa512b1823..d0c4a99984e1b09944d2dd2d964a7446dfd25818 100644 --- a/crates/settings_content/src/language.rs +++ b/crates/settings_content/src/language.rs @@ -195,8 +195,6 @@ pub struct EditPredictionSettingsContent { pub enabled_in_text_threads: Option, /// The directory where manually captured edit prediction examples are stored. pub examples_dir: Option>, - /// The number of edit prediction examples captured per ten thousand predictions. - pub example_capture_rate: Option, } #[with_fallible_options]