only render retrieve context button if semantic index is enabled

This commit is contained in:
KCaverly 2023-10-03 12:09:35 +03:00
parent 166ca2a227
commit ed894cc06f
2 changed files with 16 additions and 13 deletions

View file

@ -2750,18 +2750,22 @@ impl View for InlineAssistant {
.element() .element()
.aligned(), .aligned(),
) )
.with_child( .with_children(if SemanticIndex::enabled(cx) {
Button::action(ToggleRetrieveContext) Some(
.with_tooltip("Retrieve Context", theme.tooltip.clone()) Button::action(ToggleRetrieveContext)
.with_id(self.id) .with_tooltip("Retrieve Context", theme.tooltip.clone())
.with_contents(theme::components::svg::Svg::new( .with_id(self.id)
"icons/magnifying_glass.svg", .with_contents(theme::components::svg::Svg::new(
)) "icons/magnifying_glass.svg",
.toggleable(self.retrieve_context) ))
.with_style(theme.assistant.inline.retrieve_context.clone()) .toggleable(self.retrieve_context)
.element() .with_style(theme.assistant.inline.retrieve_context.clone())
.aligned(), .element()
) .aligned(),
)
} else {
None
})
.with_children(if let Some(error) = self.codegen.read(cx).error() { .with_children(if let Some(error) = self.codegen.read(cx).error() {
Some( Some(
Svg::new("icons/error.svg") Svg::new("icons/error.svg")

View file

@ -2,7 +2,6 @@ use crate::codegen::CodegenKind;
use language::{BufferSnapshot, OffsetRangeExt, ToOffset}; use language::{BufferSnapshot, OffsetRangeExt, ToOffset};
use std::cmp::{self, Reverse}; use std::cmp::{self, Reverse};
use std::fmt::Write; use std::fmt::Write;
use std::iter;
use std::ops::Range; use std::ops::Range;
use tiktoken_rs::ChatCompletionRequestMessage; use tiktoken_rs::ChatCompletionRequestMessage;