Improve agent prompting and classifier latency; clean up build warnings
This commit is contained in:
@@ -583,7 +583,7 @@ impl TerminalFindModel {
|
||||
} else if let Some(controller) = &mut self.async_find_controller {
|
||||
controller.clear_results(ctx);
|
||||
} else if let Some(run) = self.block_list_find_run.take() {
|
||||
for (_, rich_content_view) in self.rich_content_views.iter() {
|
||||
for rich_content_view in self.rich_content_views.values() {
|
||||
rich_content_view.clear_matches(ctx);
|
||||
}
|
||||
self.block_list_find_run = Some(run.cleared());
|
||||
|
||||
@@ -7898,7 +7898,7 @@ impl Input {
|
||||
// Emit the a11y content as the last step so that it overwrites any of the a11y content
|
||||
// emitted by the editor (if multiple `AccessibilityContent`s are emitted within the same
|
||||
// event loop, the last one wins).
|
||||
let mut accessibility_text = format!("Workflow command {} inserted.", &command_to_insert);
|
||||
let mut accessibility_text = format!("Workflow command {} inserted.", command_to_insert);
|
||||
if let Some(a11y_content) = self.selected_workflow_a11y_text(ctx) {
|
||||
let _ = write!(accessibility_text, " {a11y_content}");
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ impl InlineConversationMenuView {
|
||||
.as_ref(ctx)
|
||||
.is_conversation_menu()
|
||||
{
|
||||
let InputBufferUpdateEvent { new_content: _, .. } = event;
|
||||
let InputBufferUpdateEvent { .. } = event;
|
||||
me.rerun_query(ctx);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -679,7 +679,7 @@ impl InlineItem {
|
||||
name: skill.name.clone(),
|
||||
},
|
||||
icon_path: icon.into(),
|
||||
name: format!("/{}", &skill.name),
|
||||
name: format!("/{}", skill.name),
|
||||
description: Some(skill.description.clone()),
|
||||
font_family: appearance.monospace_font_family(),
|
||||
name_match_result: None,
|
||||
|
||||
@@ -205,12 +205,11 @@ fn parse_number(input: &[u8]) -> Option<u8> {
|
||||
let mut num: u8 = 0;
|
||||
for c in input {
|
||||
let c = *c as char;
|
||||
if let Some(digit) = c.to_digit(10) {
|
||||
{
|
||||
let digit = c.to_digit(10)?;
|
||||
num = num
|
||||
.checked_mul(10)
|
||||
.and_then(|v| v.checked_add(digit as u8))?
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
Some(num)
|
||||
|
||||
@@ -3107,7 +3107,7 @@ impl BlockList {
|
||||
log::info!(
|
||||
"Incrementing stage from {:?} to {:?}",
|
||||
self.bootstrap_stage,
|
||||
&next_bootstrap_stage
|
||||
next_bootstrap_stage
|
||||
);
|
||||
self.bootstrap_stage = next_bootstrap_stage;
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ impl BlockListSelection {
|
||||
let head_is_below_tail = (self.head.point.row > self.tail.point.row
|
||||
&& !block_list.is_inverted)
|
||||
|| (self.head.point.row < self.tail.point.row && block_list.is_inverted);
|
||||
// select-up and select-down do nothing when there's no rendered selection.
|
||||
let (mut head, mut tail) = if head_is_below_tail {
|
||||
(self.tail, self.head)
|
||||
} else {
|
||||
@@ -478,40 +479,38 @@ impl BlockList {
|
||||
) -> Option<BlockListPoint> {
|
||||
let tail = match self.expand_selection(semantic_selection, inverted_blocklist) {
|
||||
Some(selection) => selection.tail().within_grid_point,
|
||||
None => match self.selection.take() {
|
||||
None => return None,
|
||||
Some(mut selection) => {
|
||||
// In this case, there's an underlying selection that spans an empty range
|
||||
// and has no rendering.
|
||||
//
|
||||
// The selection is in one of two formats:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L)
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R)
|
||||
// And we should update the selection to this:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y, side: L)
|
||||
let start_anchor = selection.start_anchor().point;
|
||||
None => {
|
||||
let mut selection = self.selection.take()?;
|
||||
// In this case, there's an underlying selection that spans an empty range
|
||||
// and has no rendering.
|
||||
//
|
||||
// The selection is in one of two formats:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L)
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R)
|
||||
// And we should update the selection to this:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y, side: L)
|
||||
let start_anchor = selection.start_anchor().point;
|
||||
|
||||
selection.tail.point = start_anchor;
|
||||
selection.tail.side = Side::Left;
|
||||
selection.head.point = start_anchor;
|
||||
selection.head.side = Side::Right;
|
||||
self.set_selection(selection);
|
||||
return Some(start_anchor);
|
||||
}
|
||||
},
|
||||
selection.tail.point = start_anchor;
|
||||
selection.tail.side = Side::Left;
|
||||
selection.head.point = start_anchor;
|
||||
selection.head.side = Side::Right;
|
||||
self.set_selection(selection);
|
||||
return Some(start_anchor);
|
||||
}
|
||||
};
|
||||
|
||||
let mut selection = self.selection.take()?;
|
||||
|
||||
let tail_point = tail.get();
|
||||
let grid = match self.block_at(tail.block_index) {
|
||||
None => return None,
|
||||
Some(block) => match tail.grid {
|
||||
let grid = {
|
||||
let block = self.block_at(tail.block_index)?;
|
||||
match tail.grid {
|
||||
GridType::Prompt => block.prompt_grid(),
|
||||
GridType::PromptAndCommand => block.prompt_and_command_grid(),
|
||||
GridType::Rprompt => block.rprompt_grid(),
|
||||
GridType::Output => block.output_grid(),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// There are two cases:
|
||||
@@ -559,40 +558,38 @@ impl BlockList {
|
||||
) -> Option<BlockListPoint> {
|
||||
let tail = match self.expand_selection(semantic_selection, inverted_blocklist) {
|
||||
Some(selection) => selection.tail().within_grid_point,
|
||||
None => match self.selection.take() {
|
||||
None => return None,
|
||||
Some(mut selection) => {
|
||||
// In this case, there's an underlying selection that spans an empty range
|
||||
// and has no rendering.
|
||||
//
|
||||
// The selection is in one of two formats:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L)
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R)
|
||||
// And we should update the selection to this:
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y + 1, side: R)
|
||||
let end_anchor = selection.end_anchor().point;
|
||||
None => {
|
||||
let mut selection = self.selection.take()?;
|
||||
// In this case, there's an underlying selection that spans an empty range
|
||||
// and has no rendering.
|
||||
//
|
||||
// The selection is in one of two formats:
|
||||
// (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L)
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R)
|
||||
// And we should update the selection to this:
|
||||
// (row: x, col: y + 1, side: L) --> (row: x, col: y + 1, side: R)
|
||||
let end_anchor = selection.end_anchor().point;
|
||||
|
||||
selection.head.point = end_anchor;
|
||||
selection.head.side = Side::Left;
|
||||
selection.tail.point = end_anchor;
|
||||
selection.tail.side = Side::Right;
|
||||
self.set_selection(selection);
|
||||
return Some(end_anchor);
|
||||
}
|
||||
},
|
||||
selection.head.point = end_anchor;
|
||||
selection.head.side = Side::Left;
|
||||
selection.tail.point = end_anchor;
|
||||
selection.tail.side = Side::Right;
|
||||
self.set_selection(selection);
|
||||
return Some(end_anchor);
|
||||
}
|
||||
};
|
||||
|
||||
let mut selection = self.selection.take()?;
|
||||
|
||||
let tail_point = tail.get();
|
||||
let grid = match self.block_at(tail.block_index) {
|
||||
None => return None,
|
||||
Some(block) => match tail.grid {
|
||||
let grid = {
|
||||
let block = self.block_at(tail.block_index)?;
|
||||
match tail.grid {
|
||||
GridType::Prompt => block.prompt_grid(),
|
||||
GridType::PromptAndCommand => block.prompt_and_command_grid(),
|
||||
GridType::Rprompt => block.rprompt_grid(),
|
||||
GridType::Output => block.output_grid(),
|
||||
},
|
||||
}
|
||||
};
|
||||
let num_rows_in_grid = grid.len_displayed();
|
||||
|
||||
@@ -639,15 +636,14 @@ impl BlockList {
|
||||
semantic_selection: &SemanticSelection,
|
||||
inverted_blocklist: bool,
|
||||
) -> Option<BlockListPoint> {
|
||||
let (mut head, mut tail) =
|
||||
match self.expand_selection(semantic_selection, inverted_blocklist) {
|
||||
Some(selection) => (
|
||||
selection.head().within_grid_point,
|
||||
selection.tail().within_grid_point,
|
||||
),
|
||||
// select-up and select-down do nothing when there's no rendered selection.
|
||||
None => return None,
|
||||
};
|
||||
// select-up and select-down do nothing when there's no rendered selection.
|
||||
let (mut head, mut tail) = {
|
||||
let selection = self.expand_selection(semantic_selection, inverted_blocklist)?;
|
||||
(
|
||||
selection.head().within_grid_point,
|
||||
selection.tail().within_grid_point,
|
||||
)
|
||||
};
|
||||
|
||||
let mut selection = self.selection.take()?;
|
||||
|
||||
@@ -663,14 +659,14 @@ impl BlockList {
|
||||
}
|
||||
|
||||
let tail_point = tail.get();
|
||||
let grid = match self.block_at(tail.block_index) {
|
||||
None => return None,
|
||||
Some(block) => match tail.grid {
|
||||
let grid = {
|
||||
let block = self.block_at(tail.block_index)?;
|
||||
match tail.grid {
|
||||
GridType::Prompt => block.prompt_grid(),
|
||||
GridType::PromptAndCommand => block.prompt_and_command_grid(),
|
||||
GridType::Rprompt => block.rprompt_grid(),
|
||||
GridType::Output => block.output_grid(),
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// There are two cases:
|
||||
@@ -719,15 +715,14 @@ impl BlockList {
|
||||
semantic_selection: &SemanticSelection,
|
||||
inverted_blocklist: bool,
|
||||
) -> Option<BlockListPoint> {
|
||||
let (mut head, mut tail) =
|
||||
match self.expand_selection(semantic_selection, inverted_blocklist) {
|
||||
Some(selection) => (
|
||||
selection.head().within_grid_point,
|
||||
selection.tail().within_grid_point,
|
||||
),
|
||||
// select-up and select-down do nothing when there's no rendered selection.
|
||||
None => return None,
|
||||
};
|
||||
// select-up and select-down do nothing when there's no rendered selection.
|
||||
let (mut head, mut tail) = {
|
||||
let selection = self.expand_selection(semantic_selection, inverted_blocklist)?;
|
||||
(
|
||||
selection.head().within_grid_point,
|
||||
selection.tail().within_grid_point,
|
||||
)
|
||||
};
|
||||
|
||||
let mut selection = self.selection.take()?;
|
||||
|
||||
@@ -766,14 +761,14 @@ impl BlockList {
|
||||
inverted_blocklist: bool,
|
||||
) -> Option<(WithinBlock<Point>, bool)> {
|
||||
let tail_point = tail.get();
|
||||
let grid = match self.block_at(tail.block_index) {
|
||||
None => return None,
|
||||
Some(block) => match tail.grid {
|
||||
let grid = {
|
||||
let block = self.block_at(tail.block_index)?;
|
||||
match tail.grid {
|
||||
GridType::Prompt => block.prompt_grid(),
|
||||
GridType::PromptAndCommand => block.prompt_and_command_grid(),
|
||||
GridType::Rprompt => block.rprompt_grid(),
|
||||
GridType::Output => block.output_grid(),
|
||||
},
|
||||
}
|
||||
};
|
||||
let num_rows_in_grid = grid.len_displayed();
|
||||
let mut is_at_bottom = false;
|
||||
|
||||
@@ -232,7 +232,7 @@ impl InBandCommandExecutor {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::warn!("Cached in-band command ID {} does not match ID of executed in-band command output {}", cmd.id, &event.command_id);
|
||||
log::warn!("Cached in-band command ID {} does not match ID of executed in-band command output {}", cmd.id, event.command_id);
|
||||
// If the command event that we received is not for the current running command,
|
||||
// we need to restore the command as the currently running command.
|
||||
*current_command = Some(cmd);
|
||||
|
||||
@@ -1263,7 +1263,7 @@ impl ProfileModelSelector {
|
||||
if let Some(llm) = self.get_selected_llm_info(MenuType::Sidecar, index, ctx) {
|
||||
log::info!(
|
||||
"Selecting base agent model {} (from model selector)",
|
||||
&llm.id
|
||||
llm.id
|
||||
);
|
||||
LLMPreferences::handle(ctx).update(ctx, |preferences, ctx| {
|
||||
preferences.update_preferred_agent_mode_llm(&llm.id, self.terminal_view_id, ctx);
|
||||
|
||||
@@ -329,12 +329,12 @@ pub fn transfer_file_sftp_command(
|
||||
}
|
||||
|
||||
// "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r \"path/to/local/file\""
|
||||
command += &format!("\\\"{}\\\"", &local_file_path);
|
||||
command += &format!("\\\"{}\\\"", local_file_path);
|
||||
|
||||
// "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r path/to/local/file pwd/on/remote"
|
||||
if let Some(pwd) = pwd {
|
||||
command += " ";
|
||||
command += &format!("\\\"{}\\\"", &pwd);
|
||||
command += &format!("\\\"{}\\\"", pwd);
|
||||
}
|
||||
|
||||
// "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r path/to/local/file pwd/on/remote""
|
||||
|
||||
@@ -945,6 +945,7 @@ impl TerminalView {
|
||||
agent_backend: Default::default(),
|
||||
active_provider_run_json: None,
|
||||
local_agent_groups: Vec::new(),
|
||||
tool_titles: Default::default(),
|
||||
server_conversation_token: None,
|
||||
conversation_usage_metadata: None,
|
||||
reverted_action_ids: None,
|
||||
|
||||
@@ -242,7 +242,7 @@ impl FileUpload {
|
||||
//"put -r path/to/local/file pwd/on/remote"
|
||||
if let Some(pwd) = remote_dest_path {
|
||||
command += " ";
|
||||
command += &format!("\\\"{}\\\"", &pwd);
|
||||
command += &format!("\\\"{}\\\"", pwd);
|
||||
}
|
||||
|
||||
command
|
||||
|
||||
Reference in New Issue
Block a user