Avoid duplicate entries in inline assistant's prompt history
This commit is contained in:
parent
7bcc59c8a5
commit
d868ec920f
1 changed files with 3 additions and 0 deletions
|
@ -507,10 +507,13 @@ impl AssistantPanel {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.inline_prompt_history
|
||||||
|
.retain(|prompt| prompt != user_prompt);
|
||||||
self.inline_prompt_history.push_back(user_prompt.into());
|
self.inline_prompt_history.push_back(user_prompt.into());
|
||||||
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
||||||
self.inline_prompt_history.pop_front();
|
self.inline_prompt_history.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
let range = pending_assist.range.clone();
|
let range = pending_assist.range.clone();
|
||||||
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
||||||
let selected_text = snapshot
|
let selected_text = snapshot
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue