mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 11:01:54 +00:00
Avoid duplicate entries in inline assistant's prompt history (#2926)
Release Notes: - Improved the inline assistant's prompt history to avoid including the same entry multiple times. (preview-only)
This commit is contained in:
parent
df3dccc23f
commit
d55132c1e8
1 changed files with 3 additions and 0 deletions
|
@ -513,10 +513,13 @@ impl AssistantPanel {
|
|||
return;
|
||||
};
|
||||
|
||||
self.inline_prompt_history
|
||||
.retain(|prompt| prompt != user_prompt);
|
||||
self.inline_prompt_history.push_back(user_prompt.into());
|
||||
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
||||
self.inline_prompt_history.pop_front();
|
||||
}
|
||||
|
||||
let range = pending_assist.range.clone();
|
||||
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
||||
let selected_text = snapshot
|
||||
|
|
Loading…
Reference in a new issue