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()
.aligned(),
)
.with_child(
Button::action(ToggleRetrieveContext)
.with_tooltip("Retrieve Context", theme.tooltip.clone())
.with_id(self.id)
.with_contents(theme::components::svg::Svg::new(
"icons/magnifying_glass.svg",
))
.toggleable(self.retrieve_context)
.with_style(theme.assistant.inline.retrieve_context.clone())
.element()
.aligned(),
)
.with_children(if SemanticIndex::enabled(cx) {
Some(
Button::action(ToggleRetrieveContext)
.with_tooltip("Retrieve Context", theme.tooltip.clone())
.with_id(self.id)
.with_contents(theme::components::svg::Svg::new(
"icons/magnifying_glass.svg",
))
.toggleable(self.retrieve_context)
.with_style(theme.assistant.inline.retrieve_context.clone())
.element()
.aligned(),
)
} else {
None
})
.with_children(if let Some(error) = self.codegen.read(cx).error() {
Some(
Svg::new("icons/error.svg")

View file

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