inline assistant: Allow to attach images from clipboard (#32087)
Noticed while working on #31848 that we do not support pasting images as context in the inline assistant Release Notes: - agent: Add support for attaching images as context from clipboard in the inline assistant
This commit is contained in:
parent
2c5aa5891d
commit
aefb798090
3 changed files with 42 additions and 52 deletions
|
@ -13,6 +13,7 @@ use assistant_context_editor::language_model_selector::ToggleModelSelector;
|
|||
use client::ErrorExt;
|
||||
use collections::VecDeque;
|
||||
use db::kvp::Dismissable;
|
||||
use editor::actions::Paste;
|
||||
use editor::display_map::EditorMargins;
|
||||
use editor::{
|
||||
ContextMenuOptions, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer,
|
||||
|
@ -99,6 +100,7 @@ impl<T: 'static> Render for PromptEditor<T> {
|
|||
|
||||
v_flex()
|
||||
.key_context("PromptEditor")
|
||||
.capture_action(cx.listener(Self::paste))
|
||||
.bg(cx.theme().colors().editor_background)
|
||||
.block_mouse_except_scroll()
|
||||
.gap_0p5()
|
||||
|
@ -303,6 +305,10 @@ impl<T: 'static> PromptEditor<T> {
|
|||
self.editor.read(cx).text(cx)
|
||||
}
|
||||
|
||||
fn paste(&mut self, _: &Paste, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
crate::active_thread::attach_pasted_images_as_context(&self.context_store, cx);
|
||||
}
|
||||
|
||||
fn toggle_rate_limit_notice(
|
||||
&mut self,
|
||||
_: &ClickEvent,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue