Fix issues in EditFilesTool, ListDirectoryTool and BashTool (#26647)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-03-13 10:41:27 +01:00 committed by GitHub
parent e842b4eade
commit 70c973f6c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 110 additions and 41 deletions

View file

@ -7,13 +7,24 @@ use handlebars::{Handlebars, RenderError};
use language::{BufferSnapshot, LanguageName, Point};
use parking_lot::Mutex;
use serde::Serialize;
use std::{ops::Range, path::PathBuf, sync::Arc, time::Duration};
use std::{
ops::Range,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
use text::LineEnding;
use util::ResultExt;
#[derive(Serialize)]
pub struct AssistantSystemPromptContext {
pub worktree_root_names: Vec<String>,
pub worktrees: Vec<AssistantSystemPromptWorktree>,
}
#[derive(Serialize)]
pub struct AssistantSystemPromptWorktree {
pub root_name: String,
pub abs_path: Arc<Path>,
}
#[derive(Serialize)]
@ -223,11 +234,9 @@ impl PromptBuilder {
pub fn generate_assistant_system_prompt(
&self,
worktree_root_names: Vec<String>,
worktrees: Vec<AssistantSystemPromptWorktree>,
) -> Result<String, RenderError> {
let prompt = AssistantSystemPromptContext {
worktree_root_names,
};
let prompt = AssistantSystemPromptContext { worktrees };
self.handlebars
.lock()
.render("assistant_system_prompt", &prompt)