MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _truncate_large_debug_value

Method _truncate_large_debug_value

src/services/flow_client.py:1889–1900  ·  view source on GitHub ↗

截断调试输出中的超长字段,避免污染控制台。

(self, data: Any, max_length: int = 240)

Source from the content-addressed store, hash-verified

1887 return None
1888
1889 def _truncate_large_debug_value(self, data: Any, max_length: int = 240) -> Any:
1890 """截断调试输出中的超长字段,避免污染控制台。"""
1891 if isinstance(data, dict):
1892 return {
1893 key: self._truncate_large_debug_value(value, max_length=max_length)
1894 for key, value in data.items()
1895 }
1896 if isinstance(data, list):
1897 return [self._truncate_large_debug_value(item, max_length=max_length) for item in data]
1898 if isinstance(data, str) and len(data) > max_length:
1899 return f"{data[:max_length]}... (truncated, total {len(data)} chars)"
1900 return data
1901
1902 def _extract_video_status_from_media(self, media: Dict[str, Any]) -> tuple[Optional[str], Dict[str, Any]]:
1903 status_block = (

Callers 1

check_video_statusMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected