assistant2: Small misc efficiency improvements (#22947)
Release Notes: - N/A
This commit is contained in:
parent
767f44bd27
commit
690ad29ba9
2 changed files with 14 additions and 16 deletions
|
@ -191,22 +191,20 @@ impl ContextStore {
|
||||||
collect_files_in_path(worktree, &project_path.path)
|
collect_files_in_path(worktree, &project_path.path)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let open_buffer_tasks = project.update(&mut cx, |project, cx| {
|
let open_buffers_task = project.update(&mut cx, |project, cx| {
|
||||||
files
|
let tasks = files.iter().map(|file_path| {
|
||||||
.iter()
|
project.open_buffer(
|
||||||
.map(|file_path| {
|
ProjectPath {
|
||||||
project.open_buffer(
|
worktree_id,
|
||||||
ProjectPath {
|
path: file_path.clone(),
|
||||||
worktree_id,
|
},
|
||||||
path: file_path.clone(),
|
cx,
|
||||||
},
|
)
|
||||||
cx,
|
});
|
||||||
)
|
future::join_all(tasks)
|
||||||
})
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let buffers = future::join_all(open_buffer_tasks).await;
|
let buffers = open_buffers_task.await;
|
||||||
|
|
||||||
let mut buffer_infos = Vec::new();
|
let mut buffer_infos = Vec::new();
|
||||||
let mut text_tasks = Vec::new();
|
let mut text_tasks = Vec::new();
|
||||||
|
|
|
@ -214,9 +214,9 @@ impl LanguageModelRequestMessage {
|
||||||
.content
|
.content
|
||||||
.first()
|
.first()
|
||||||
.map(|content| match content {
|
.map(|content| match content {
|
||||||
MessageContent::Text(text) => text.trim().is_empty(),
|
MessageContent::Text(text) => text.chars().all(|c| c.is_whitespace()),
|
||||||
MessageContent::ToolResult(tool_result) => {
|
MessageContent::ToolResult(tool_result) => {
|
||||||
tool_result.content.trim().is_empty()
|
tool_result.content.chars().all(|c| c.is_whitespace())
|
||||||
}
|
}
|
||||||
MessageContent::ToolUse(_) | MessageContent::Image(_) => true,
|
MessageContent::ToolUse(_) | MessageContent::Image(_) => true,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue