From d50905e0003e3a400414538d9a6d24523bb274e8 Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Mon, 31 Mar 2025 15:19:42 -0300 Subject: [PATCH] assistant2: Add testing environment variables (#27789) To make it easier to design UIs for some of these scenarios. This PR adds specifically two variables: - `ZED_SIMULATE_NO_THREAD_HISTORY` - `ZED_SIMULATE_NO_LLM_PROVIDER` Release Notes: - N/A --------- Co-authored-by: Agus Zubiaga --- crates/assistant2/src/history_store.rs | 5 +++++ crates/language_model/src/registry.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/crates/assistant2/src/history_store.rs b/crates/assistant2/src/history_store.rs index 169f7561a1..49f935314d 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) -> Vec { 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.rs index c3c6b3bb03..0c7d3f167f 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> { + #[cfg(debug_assertions)] + if std::env::var("ZED_SIMULATE_NO_LLM_PROVIDER").is_ok() { + return None; + } + Some(self.active_model.as_ref()?.provider.clone()) }