agent: Add "max mode" toggle (#29549)
This PR adds a "max mode" toggle to the Agent panel, for models that support it. Only visible to folks in the `new-billing` feature flag. Icon is just a placeholder. Release Notes: - N/A
This commit is contained in:
parent
e3c987e2fb
commit
ce93961fe0
14 changed files with 87 additions and 1 deletions
|
@ -34,6 +34,7 @@ use settings::Settings;
|
|||
use thiserror::Error;
|
||||
use util::{ResultExt as _, TryFutureExt as _, post_inc};
|
||||
use uuid::Uuid;
|
||||
use zed_llm_client::CompletionMode;
|
||||
|
||||
use crate::context::{AgentContext, ContextLoadResult, LoadedContext};
|
||||
use crate::thread_store::{
|
||||
|
@ -290,6 +291,7 @@ pub struct Thread {
|
|||
summary: Option<SharedString>,
|
||||
pending_summary: Task<Option<()>>,
|
||||
detailed_summary_state: DetailedSummaryState,
|
||||
completion_mode: Option<CompletionMode>,
|
||||
messages: Vec<Message>,
|
||||
next_message_id: MessageId,
|
||||
last_prompt_id: PromptId,
|
||||
|
@ -339,6 +341,7 @@ impl Thread {
|
|||
summary: None,
|
||||
pending_summary: Task::ready(None),
|
||||
detailed_summary_state: DetailedSummaryState::NotGenerated,
|
||||
completion_mode: None,
|
||||
messages: Vec::new(),
|
||||
next_message_id: MessageId(0),
|
||||
last_prompt_id: PromptId::new(),
|
||||
|
@ -394,6 +397,7 @@ impl Thread {
|
|||
summary: Some(serialized.summary),
|
||||
pending_summary: Task::ready(None),
|
||||
detailed_summary_state: serialized.detailed_summary_state,
|
||||
completion_mode: None,
|
||||
messages: serialized
|
||||
.messages
|
||||
.into_iter()
|
||||
|
@ -518,6 +522,14 @@ impl Thread {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn completion_mode(&self) -> Option<CompletionMode> {
|
||||
self.completion_mode
|
||||
}
|
||||
|
||||
pub fn set_completion_mode(&mut self, mode: Option<CompletionMode>) {
|
||||
self.completion_mode = mode;
|
||||
}
|
||||
|
||||
pub fn message(&self, id: MessageId) -> Option<&Message> {
|
||||
let index = self
|
||||
.messages
|
||||
|
@ -930,6 +942,12 @@ impl Thread {
|
|||
self.remaining_turns -= 1;
|
||||
|
||||
let mut request = self.to_completion_request(cx);
|
||||
request.mode = if model.supports_max_mode() {
|
||||
self.completion_mode
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if model.supports_tools() {
|
||||
request.tools = self
|
||||
.tools()
|
||||
|
@ -967,6 +985,7 @@ impl Thread {
|
|||
let mut request = LanguageModelRequest {
|
||||
thread_id: Some(self.id.to_string()),
|
||||
prompt_id: Some(self.last_prompt_id.to_string()),
|
||||
mode: None,
|
||||
messages: vec![],
|
||||
tools: Vec::new(),
|
||||
stop: Vec::new(),
|
||||
|
@ -1063,6 +1082,7 @@ impl Thread {
|
|||
let mut request = LanguageModelRequest {
|
||||
thread_id: None,
|
||||
prompt_id: None,
|
||||
mode: None,
|
||||
messages: vec![],
|
||||
tools: Vec::new(),
|
||||
stop: Vec::new(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue