Simplify logic & add UI affordances to show model cache status (#16395)
Release Notes: - Adds UI affordances to the assistant panel to show which messages have been cached - Migrate cache invalidation to be based on `has_edits_since_in_range` to be smarter and more selective about when to invalidate the cache and when to fetch. <img width="310" alt="Screenshot 2024-08-16 at 11 19 23 PM" src="https://github.com/user-attachments/assets/4ee2d111-2f55-4b0e-b944-50c4f78afc42"> <img width="580" alt="Screenshot 2024-08-18 at 10 05 16 PM" src="https://github.com/user-attachments/assets/17630a60-7b78-421c-ae39-425246638a12"> I had originally added the lightening bolt on every message and only added the tooltip warning about editing prior messages on the first anchor, but thought it looked too busy, so I settled on just annotating the last anchor.
This commit is contained in:
parent
971db5c6f6
commit
0042c24d3c
5 changed files with 365 additions and 77 deletions
|
@ -11,11 +11,11 @@ use crate::{
|
|||
},
|
||||
slash_command_picker,
|
||||
terminal_inline_assistant::TerminalInlineAssistant,
|
||||
Assist, ConfirmCommand, Context, ContextEvent, ContextId, ContextStore, CycleMessageRole,
|
||||
DeployHistory, DeployPromptLibrary, InlineAssist, InlineAssistId, InlineAssistant,
|
||||
InsertIntoEditor, MessageStatus, ModelSelector, PendingSlashCommand, PendingSlashCommandStatus,
|
||||
QuoteSelection, RemoteContextMetadata, SavedContextMetadata, Split, ToggleFocus,
|
||||
ToggleModelSelector, WorkflowStepResolution, WorkflowStepView,
|
||||
Assist, CacheStatus, ConfirmCommand, Context, ContextEvent, ContextId, ContextStore,
|
||||
CycleMessageRole, DeployHistory, DeployPromptLibrary, InlineAssist, InlineAssistId,
|
||||
InlineAssistant, InsertIntoEditor, MessageStatus, ModelSelector, PendingSlashCommand,
|
||||
PendingSlashCommandStatus, QuoteSelection, RemoteContextMetadata, SavedContextMetadata, Split,
|
||||
ToggleFocus, ToggleModelSelector, WorkflowStepResolution, WorkflowStepView,
|
||||
};
|
||||
use crate::{ContextStoreEvent, ModelPickerDelegate};
|
||||
use anyhow::{anyhow, Result};
|
||||
|
@ -3137,6 +3137,36 @@ impl ContextEditor {
|
|||
.relative()
|
||||
.gap_1()
|
||||
.child(sender)
|
||||
.children(match &message.cache {
|
||||
Some(cache) if cache.is_final_anchor => match cache.status {
|
||||
CacheStatus::Cached => Some(
|
||||
div()
|
||||
.id("cached")
|
||||
.child(
|
||||
Icon::new(IconName::DatabaseZap)
|
||||
.size(IconSize::XSmall)
|
||||
.color(Color::Hint),
|
||||
)
|
||||
.tooltip(|cx| {
|
||||
Tooltip::with_meta(
|
||||
"Context cached",
|
||||
None,
|
||||
"Large messages cached to optimize performance",
|
||||
cx,
|
||||
)
|
||||
}).into_any_element()
|
||||
),
|
||||
CacheStatus::Pending => Some(
|
||||
div()
|
||||
.child(
|
||||
Icon::new(IconName::Ellipsis)
|
||||
.size(IconSize::XSmall)
|
||||
.color(Color::Hint),
|
||||
).into_any_element()
|
||||
),
|
||||
},
|
||||
_ => None,
|
||||
})
|
||||
.children(match &message.status {
|
||||
MessageStatus::Error(error) => Some(
|
||||
Button::new("show-error", "Error")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue