From 44c2a27ce0695d8e9c7e72f9a84dc325cb15096a Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 9 Jul 2026 16:20:19 -0500 Subject: [PATCH] refac --- backend/open_webui/utils/context_compaction.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/open_webui/utils/context_compaction.py b/backend/open_webui/utils/context_compaction.py index e20f6b9cdc..209f56892f 100644 --- a/backend/open_webui/utils/context_compaction.py +++ b/backend/open_webui/utils/context_compaction.py @@ -205,9 +205,7 @@ def _parse_positive_int(value: Any) -> int | None: def _resolve_token_threshold(global_threshold: int, metadata: dict) -> int: configured_threshold = _parse_positive_int((metadata.get('params') or {}).get('compact_token_threshold')) - if configured_threshold is None: - return global_threshold - return min(configured_threshold, global_threshold) + return configured_threshold or global_threshold def _apply_latest_summary_checkpoint(messages: list[dict]) -> tuple[list[dict], str | None]: