agent: Show warning for image context pill if model doesn't support images (#31848)
Closes #31781 Currently we don't any warning or error if the image is not supported by the current model in selected in the agent panel which leads for users to think it's supported as there is no visual feedback provided by zed. This PR adds a warning on image context pill to show warning when the model doesn't support it. | Before | After | |--------|-------| | <img width="374" alt="image" src="https://github.com/user-attachments/assets/da659fb6-d5da-4c53-8878-7a1c4553f168" /> | <img width="442" alt="image" src="https://github.com/user-attachments/assets/0f23d184-6095-47e2-8f2b-0eac64a0942e" /> | Release Notes: - Show warning for image context pill in agent panel when selected model doesn't support images. --------- Signed-off-by: Umesh Yadav <git@umesh.dev> Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This commit is contained in:
parent
cde47e60cd
commit
7d54d9f45e
7 changed files with 149 additions and 34 deletions
|
@ -1,4 +1,3 @@
|
|||
use crate::AgentPanel;
|
||||
use crate::context::{AgentContextHandle, RULES_ICON};
|
||||
use crate::context_picker::{ContextPicker, MentionLink};
|
||||
use crate::context_store::ContextStore;
|
||||
|
@ -13,6 +12,7 @@ use crate::tool_use::{PendingToolUseStatus, ToolUse};
|
|||
use crate::ui::{
|
||||
AddedContext, AgentNotification, AgentNotificationEvent, AnimatedLabel, ContextPill,
|
||||
};
|
||||
use crate::{AgentPanel, ModelUsageContext};
|
||||
use agent_settings::{AgentSettings, NotifyWhenAgentWaiting};
|
||||
use anyhow::Context as _;
|
||||
use assistant_tool::ToolUseStatus;
|
||||
|
@ -1348,6 +1348,7 @@ impl ActiveThread {
|
|||
Some(self.text_thread_store.downgrade()),
|
||||
context_picker_menu_handle.clone(),
|
||||
SuggestContextKind::File,
|
||||
ModelUsageContext::Thread(self.thread.clone()),
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
|
@ -1826,9 +1827,10 @@ impl ActiveThread {
|
|||
|
||||
// Get all the data we need from thread before we start using it in closures
|
||||
let checkpoint = thread.checkpoint_for_message(message_id);
|
||||
let configured_model = thread.configured_model().map(|m| m.model);
|
||||
let added_context = thread
|
||||
.context_for_message(message_id)
|
||||
.map(|context| AddedContext::new_attached(context, cx))
|
||||
.map(|context| AddedContext::new_attached(context, configured_model.as_ref(), cx))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let tool_uses = thread.tool_uses_for_message(message_id, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue