From 0444b5a7757abce9dab6cbdf218014cc07e72c4a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 25 Aug 2023 13:36:52 +0200 Subject: [PATCH] :lipstick: --- crates/ai/src/assistant.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rs index 9311a00751..b8458bb9ac 100644 --- a/crates/ai/src/assistant.rs +++ b/crates/ai/src/assistant.rs @@ -214,12 +214,12 @@ impl AssistantPanel { } fn inline_assist(workspace: &mut Workspace, _: &InlineAssist, cx: &mut ViewContext) { - let assistant = if let Some(assistant) = workspace.panel::(cx) { - if assistant + let this = if let Some(this) = workspace.panel::(cx) { + if this .update(cx, |assistant, cx| assistant.load_api_key(cx)) .is_some() { - assistant + this } else { workspace.focus_panel::(cx); return; @@ -237,7 +237,7 @@ impl AssistantPanel { return; }; - assistant.update(cx, |assistant, cx| { + this.update(cx, |assistant, cx| { assistant.new_inline_assist(&active_editor, cx) }); } @@ -1046,7 +1046,7 @@ impl AssistantPanel { .position(|editor| editor.read(cx).conversation.read(cx).path.as_deref() == Some(path)) } - pub fn load_api_key(&mut self, cx: &mut ViewContext) -> Option { + fn load_api_key(&mut self, cx: &mut ViewContext) -> Option { if self.api_key.borrow().is_none() && !self.has_read_credentials { self.has_read_credentials = true; let api_key = if let Ok(api_key) = env::var("OPENAI_API_KEY") {