acp: Show output for read_file tool in a code block (#36900)
Release Notes: - N/A
This commit is contained in:
parent
9cc006ff74
commit
823a0018e5
1 changed files with 14 additions and 0 deletions
|
@ -11,6 +11,7 @@ use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use settings::Settings;
|
use settings::Settings;
|
||||||
use std::{path::Path, sync::Arc};
|
use std::{path::Path, sync::Arc};
|
||||||
|
use util::markdown::MarkdownCodeBlock;
|
||||||
|
|
||||||
use crate::{AgentTool, ToolCallEventStream};
|
use crate::{AgentTool, ToolCallEventStream};
|
||||||
|
|
||||||
|
@ -243,6 +244,19 @@ impl AgentTool for ReadFileTool {
|
||||||
}]),
|
}]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
if let Ok(LanguageModelToolResultContent::Text(text)) = &result {
|
||||||
|
let markdown = MarkdownCodeBlock {
|
||||||
|
tag: &input.path,
|
||||||
|
text,
|
||||||
|
}
|
||||||
|
.to_string();
|
||||||
|
event_stream.update_fields(ToolCallUpdateFields {
|
||||||
|
content: Some(vec![acp::ToolCallContent::Content {
|
||||||
|
content: markdown.into(),
|
||||||
|
}]),
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue