nit: parse_arguments (#8927)

This commit is contained in:
jif-oai
2026-01-08 19:49:17 +00:00
committed by GitHub
parent 634764ece9
commit c9c6560685
10 changed files with 41 additions and 60 deletions

View File

@@ -11,7 +11,9 @@ mod unified_exec;
mod view_image;
pub use plan::PLAN_TOOL;
use serde::Deserialize;
use crate::function_tool::FunctionCallError;
pub use apply_patch::ApplyPatchHandler;
pub use grep_files::GrepFilesHandler;
pub use list_dir::ListDirHandler;
@@ -24,3 +26,12 @@ pub use shell::ShellHandler;
pub use test_sync::TestSyncHandler;
pub use unified_exec::UnifiedExecHandler;
pub use view_image::ViewImageHandler;
fn parse_arguments<T>(arguments: &str) -> Result<T, FunctionCallError>
where
T: for<'de> Deserialize<'de>,
{
serde_json::from_str(arguments).map_err(|err| {
FunctionCallError::RespondToModel(format!("failed to parse function arguments: {err}"))
})
}