MCPcopy Create free account
hub / github.com/Louisym/MiniCC / _truncate

Function _truncate

tutorials/06_system_prompt_builder.py:177–181  ·  view source on GitHub ↗

截断过长的内容

(content: str, max_chars: int)

Source from the content-addressed store, hash-verified

175
176
177def _truncate(content: str, max_chars: int) -> str:
178 """截断过长的内容"""
179 if len(content) <= max_chars:
180 return content
181 return content[:max_chars] + "\n\n[truncated]"
182
183
184# ============================================================

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected