MCPcopy Create free account
hub / github.com/AstrBotDevs/AstrBot / _content_to_text

Function _content_to_text

astrbot/core/agent/context/round_utils.py:38–47  ·  view source on GitHub ↗
(content: Any)

Source from the content-addressed store, hash-verified

36
37
38def _content_to_text(content: Any) -> str:
39 if isinstance(content, list):
40 normalized = [
41 part.model_dump_for_context() if isinstance(part, ContentPart) else part
42 for part in content
43 ]
44 return json.dumps(normalized, ensure_ascii=False)
45 if isinstance(content, ContentPart):
46 return json.dumps(content.model_dump_for_context(), ensure_ascii=False)
47 return str(content or "")
48
49
50def _segment_content(seg: RoundSegment) -> Any:

Callers 1

rounds_to_textFunction · 0.85

Calls 1

Tested by

no test coverage detected