refac
This commit is contained in:
1 parent
966b3fdb57
commit
8b35ce924b
1 file changed
+3
@@ -141,6 +141,9 @@ def truncate_content(content: str, max_chars: int, mode: str = 'middletruncate')
|
|||||||
- start: keep first max_chars characters
|
- start: keep first max_chars characters
|
||||||
- end: keep last max_chars characters
|
- end: keep last max_chars characters
|
||||||
"""
|
"""
|
||||||
|
if max_chars <= 0:
|
||||||
|
return ''
|
||||||
|
|
||||||
if not content or len(content) <= max_chars:
|
if not content or len(content) <= max_chars:
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user