Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
assistant2: Add testing environment variables (#27789)
Danilo Leald50905e0003e
diff --git a/crates/assistant2/src/history_store.rs b/crates/assistant2/src/history_store.rsindex 169f7561a13..49f935314dd 100644--- a/crates/assistant2/src/history_store.rs+++ b/crates/assistant2/src/history_store.rs@@ -43,6 +43,11 @@ impl HistoryStore {pub fn entries(&self, cx: &mut Context<Self>) -> Vec<HistoryEntry> {let mut history_entries = Vec::new();+ #[cfg(debug_assertions)]+ if std::env::var("ZED_SIMULATE_NO_THREAD_HISTORY").is_ok() {+ return history_entries;+ }+for thread in self.thread_store.update(cx, |this, _cx| this.threads()) {history_entries.push(HistoryEntry::Thread(thread));}diff --git a/crates/language_model/src/registry.rs b/crates/language_model/src/registry.rsindex c3c6b3bb036..0c7d3f167f8 100644--- a/crates/language_model/src/registry.rs+++ b/crates/language_model/src/registry.rs@@ -203,6 +203,11 @@ impl LanguageModelRegistry {}pub fn active_provider(&self) -> Option<Arc<dyn LanguageModelProvider>> {+ #[cfg(debug_assertions)]+ if std::env::var("ZED_SIMULATE_NO_LLM_PROVIDER").is_ok() {+ return None;+ }+Some(self.active_model.as_ref()?.provider.clone())}