zeta2: Provider setup (#38676)
Creates a new `EditPredictionProvider` for zeta2, that requests completions from a new cloud endpoint including context from the new `edit_prediction_context` crate. This is not ready for use, but it allows us to iterate. Release Notes: - N/A --------- Co-authored-by: Michael Sloan <michael@zed.dev> Co-authored-by: Bennet <bennet@zed.dev> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
co-authored by
Michael Sloan
Bennet
Bennet Bo Fenner
parent
e9abd5b28b
commit
c9e3b32366
@@ -4,7 +4,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
str::FromStr,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use collections::HashMap;
|
||||
@@ -195,6 +195,8 @@ impl EditPredictionTools {
|
||||
.timer(Duration::from_millis(50))
|
||||
.await;
|
||||
|
||||
let mut start_time = None;
|
||||
|
||||
let Ok(task) = this.update(cx, |this, cx| {
|
||||
fn number_input_value<T: FromStr + Default>(
|
||||
input: &Entity<SingleLineInput>,
|
||||
@@ -216,15 +218,16 @@ impl EditPredictionTools {
|
||||
&this.cursor_context_ratio_input,
|
||||
cx,
|
||||
),
|
||||
// TODO Display and add to options
|
||||
include_parent_signatures: false,
|
||||
};
|
||||
|
||||
EditPredictionContext::gather(
|
||||
start_time = Some(Instant::now());
|
||||
|
||||
// TODO use global zeta instead
|
||||
EditPredictionContext::gather_context_in_background(
|
||||
cursor_position,
|
||||
current_buffer_snapshot,
|
||||
options,
|
||||
this.syntax_index.clone(),
|
||||
Some(this.syntax_index.clone()),
|
||||
cx,
|
||||
)
|
||||
}) else {
|
||||
@@ -243,6 +246,7 @@ impl EditPredictionTools {
|
||||
.ok();
|
||||
return;
|
||||
};
|
||||
let retrieval_duration = start_time.unwrap().elapsed();
|
||||
|
||||
let mut languages = HashMap::default();
|
||||
for snippet in context.snippets.iter() {
|
||||
@@ -320,7 +324,7 @@ impl EditPredictionTools {
|
||||
|
||||
this.last_context = Some(ContextState {
|
||||
context_editor,
|
||||
retrieval_duration: context.retrieval_duration,
|
||||
retrieval_duration,
|
||||
});
|
||||
cx.notify();
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user