Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

catchup with main

KCaverly0dfbfdd16428
diff --cc crates/ai/src/embedding.rs
index 4e67f44cae7,4d5e40fad98..0f895156f74
--- a/crates/ai/src/embedding.rs
+++ b/crates/ai/src/embedding.rs
@@@ -1,11 -1,32 +1,12 @@@
-use anyhow::{anyhow, Result};
++use std::time::Instant;
++
+use anyhow::Result;
use async_trait::async_trait;
-use futures::AsyncReadExt;
-use gpui::executor::Background;
-use gpui::{serde_json, ViewContext};
-use isahc::http::StatusCode;
-use isahc::prelude::Configurable;
-use isahc::{AsyncBody, Response};
-use lazy_static::lazy_static;
use ordered_float::OrderedFloat;
-use parking_lot::Mutex;
-use parse_duration::parse;
-use postage::watch;
use rusqlite::types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef};
use rusqlite::ToSql;
- use std::time::Instant;
-use serde::{Deserialize, Serialize};
-use std::env;
-use std::ops::Add;
-use std::sync::Arc;
-use std::time::{Duration, Instant};
-use tiktoken_rs::{cl100k_base, CoreBPE};
-use util::http::{HttpClient, Request};
-use util::ResultExt;
-
-use crate::completion::OPENAI_API_URL;
-lazy_static! {
- static ref OPENAI_BPE_TOKENIZER: CoreBPE = cl100k_base().unwrap();
-}
+use crate::models::LanguageModel;
#[derive(Debug, PartialEq, Clone)]
pub struct Embedding(pub Vec<f32>);
diff --cc crates/zed/examples/semantic_index_eval.rs
index 0bada475022,73b3b9987b0..f16114e9063
--- a/crates/zed/examples/semantic_index_eval.rs
+++ b/crates/zed/examples/semantic_index_eval.rs
@@@ -469,6 -471,20 +469,7 @@@ fn main()
.join("embeddings_db");
let languages = languages.clone();
+
- let api_key = if let Ok(api_key) = env::var("OPENAI_API_KEY") {
- Some(api_key)
- } else if let Some((_, api_key)) = cx
- .platform()
- .read_credentials(OPENAI_API_URL)
- .log_err()
- .flatten()
- {
- String::from_utf8(api_key).log_err()
- } else {
- None
- };
-
let fs = fs.clone();
cx.spawn(|mut cx| async move {
let semantic_index = SemanticIndex::new(