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(
|
fn run(
|
||||||
self: Arc<Self>,
|
self: Arc<Self>,
|
||||||
input: Self::Input,
|
input: Self::Input,
|
||||||
_event_stream: ToolCallEventStream,
|
event_stream: ToolCallEventStream,
|
||||||
cx: &mut App,
|
cx: &mut App,
|
||||||
) -> Task<Result<Self::Output>> {
|
) -> Task<Result<Self::Output>> {
|
||||||
|
let authorize = event_stream.authorize(input.url.clone(), cx);
|
||||||
|
|
||||||
let text = cx.background_spawn({
|
let text = cx.background_spawn({
|
||||||
let http_client = self.http_client.clone();
|
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 {
|
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 {
|
fn needs_confirmation(&self, _: &serde_json::Value, _: &Entity<Project>, _: &App) -> bool {
|
||||||
false
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn may_perform_edits(&self) -> bool {
|
fn may_perform_edits(&self) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue