截断过长的内容
(content: str, max_chars: int)
| 175 | |
| 176 | |
| 177 | def _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 | # ============================================================ |
no outgoing calls
no test coverage detected