zeta2: Build edit prediction prompt and process model output in client (#41870)
Release Notes: - N/A --------- Co-authored-by: Agus Zubiaga <agus@zed.dev> Co-authored-by: Ben Kunkle <ben@zed.dev> Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
co-authored by
Agus Zubiaga
Ben Kunkle
Piotr Osiewicz
parent
fb87972f44
commit
784fdcaee3
@@ -7,13 +7,14 @@ use std::{
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Args;
|
||||
use cloud_llm_client::udiff::DiffLine;
|
||||
use collections::HashSet;
|
||||
use gpui::AsyncApp;
|
||||
use zeta2::udiff::DiffLine;
|
||||
|
||||
use crate::{
|
||||
example::{Example, NamedExample},
|
||||
headless::ZetaCliAppState,
|
||||
paths::CACHE_DIR,
|
||||
predict::{PredictionDetails, zeta2_predict},
|
||||
};
|
||||
|
||||
@@ -54,10 +55,8 @@ pub async fn run_evaluate_one(
|
||||
app_state: Arc<ZetaCliAppState>,
|
||||
cx: &mut AsyncApp,
|
||||
) -> Result<EvaluationResult> {
|
||||
let cache_dir = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap_or_default())
|
||||
.join("../../target/zeta-prediction-cache");
|
||||
let example = NamedExample::load(&example_path).unwrap();
|
||||
let example_cache_path = cache_dir.join(&example_path.file_name().unwrap());
|
||||
let example_cache_path = CACHE_DIR.join(&example_path.file_name().unwrap());
|
||||
|
||||
let predictions = if !re_run && example_cache_path.exists() {
|
||||
let file_contents = fs::read_to_string(&example_cache_path)?;
|
||||
@@ -74,7 +73,7 @@ pub async fn run_evaluate_one(
|
||||
};
|
||||
|
||||
if !example_cache_path.exists() {
|
||||
fs::create_dir_all(&cache_dir).unwrap();
|
||||
fs::create_dir_all(&*CACHE_DIR).unwrap();
|
||||
fs::write(
|
||||
example_cache_path,
|
||||
serde_json::to_string(&predictions).unwrap(),
|
||||
|
||||
Reference in New Issue
Block a user