(tool_input: Option<&Value>, response: &Value)
| 572 | } |
| 573 | |
| 574 | fn extract_file_path(tool_input: Option<&Value>, response: &Value) -> Option<String> { |
| 575 | for value in [tool_input, Some(response)].into_iter().flatten() { |
| 576 | for key in ["file_path", "filePath", "path"] { |
| 577 | if let Some(path) = value.get(key).and_then(Value::as_str) { |
| 578 | return Some(path.to_string()); |
| 579 | } |
| 580 | } |
| 581 | } |
| 582 | None |
| 583 | } |
| 584 | |
| 585 | fn insert_if_missing(raw: &mut Value, key: &str, value: Value) { |
| 586 | if let Some(obj) = raw.as_object_mut() { |
no test coverage detected