(value: &mut serde_json::Value, remaining_budget: &mut usize)
| 453 | } |
| 454 | |
| 455 | fn compact_json_for_session_view(value: &mut serde_json::Value, remaining_budget: &mut usize) { |
| 456 | match value { |
| 457 | serde_json::Value::String(text) => { |
| 458 | if let Some(preview) = truncate_string_for_session_view(text, remaining_budget) { |
| 459 | *text = preview; |
| 460 | } |
| 461 | } |
| 462 | serde_json::Value::Array(items) => { |
| 463 | for item in items { |
| 464 | compact_json_for_session_view(item, remaining_budget); |
| 465 | } |
| 466 | } |
| 467 | serde_json::Value::Object(map) => { |
| 468 | for item in map.values_mut() { |
| 469 | compact_json_for_session_view(item, remaining_budget); |
| 470 | } |
| 471 | } |
| 472 | _ => {} |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | fn compact_tool_results_for_session_view(turns: &mut [DialogTurnData]) { |
| 477 | let mut remaining_budget = SESSION_VIEW_TOOL_RESULT_TOTAL_CHAR_BUDGET; |
no test coverage detected