From 8b35ce924b120ac7c6eec0eb6119243f23c6202b Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 17 Jun 2026 00:15:04 +0200 Subject: [PATCH] refac --- backend/open_webui/utils/task.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/open_webui/utils/task.py b/backend/open_webui/utils/task.py index 0b5f628305..fe3c8923f1 100644 --- a/backend/open_webui/utils/task.py +++ b/backend/open_webui/utils/task.py @@ -141,6 +141,9 @@ def truncate_content(content: str, max_chars: int, mode: str = 'middletruncate') - start: keep first max_chars characters - end: keep last max_chars characters """ + if max_chars <= 0: + return '' + if not content or len(content) <= max_chars: return content