refactor/类型化工具调用错误 #568
@@ -1718,6 +1718,7 @@ fn bridge_file_content_changed(root: &Path, path: &str, content: &[u8]) -> Optio
|
||||
pub(in crate::agent) fn write_file_input(
|
||||
arguments: &Value,
|
||||
) -> Result<(String, String), WriteFileError> {
|
||||
ToolArgumentsRejection::check(arguments, &["path", "content"])?;
|
||||
let raw_path = arguments
|
||||
.get("path")
|
||||
.and_then(Value::as_str)
|
||||
|
||||
@@ -2849,6 +2849,12 @@ mod tests {
|
||||
"content": "{}"
|
||||
}))
|
||||
.is_err());
|
||||
assert!(validate_write_file_arguments(&json!({
|
||||
"path": "game/index.html",
|
||||
"content": "<html></html>",
|
||||
"unexpected": 1
|
||||
}))
|
||||
.is_err());
|
||||
assert_eq!(
|
||||
direct_tool_bridge::prepare_game_art_input(&json!({ "brief": "美术包" }))
|
||||
.expect("safe default")
|
||||
|
||||
Reference in New Issue
Block a user