Require confirmation for fetch tool
This commit is contained in:
parent
69127d2bea
commit
273a58bf66
2 changed files with 8 additions and 3 deletions
|
@ -136,12 +136,17 @@ impl AgentTool for FetchTool {
|
|||
fn run(
|
||||
self: Arc<Self>,
|
||||
input: Self::Input,
|
||||
_event_stream: ToolCallEventStream,
|
||||
event_stream: ToolCallEventStream,
|
||||
cx: &mut App,
|
||||
) -> Task<Result<Self::Output>> {
|
||||
let authorize = event_stream.authorize(input.url.clone(), cx);
|
||||
|
||||
let text = cx.background_spawn({
|
||||
let http_client = self.http_client.clone();
|
||||
async move { Self::build_message(http_client, &input.url).await }
|
||||
async move {
|
||||
authorize.await?;
|
||||
Self::build_message(http_client, &input.url).await
|
||||
}
|
||||
});
|
||||
|
||||
cx.foreground_executor().spawn(async move {
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Tool for FetchTool {
|
|||
}
|
||||
|
||||
fn needs_confirmation(&self, _: &serde_json::Value, _: &Entity<Project>, _: &App) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn may_perform_edits(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue