diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index 4ce20dc023..9179f9a4b8 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -1043,7 +1043,8 @@ ENABLE_CHAT_RESPONSE_BASE64_IMAGE_URL_CONVERSION = ( ENABLE_API_OUTLET_FILTERS = os.getenv('ENABLE_API_OUTLET_FILTERS', 'True').lower() == 'true' # Opt in to CPython's in-place string append optimization for streamed responses. -# Disabled by default: allocation failure in the fast path can erase accumulated text. +# Off by default for a staged rollout. Only a host already out of memory can lose +# text here; the default path (a full copy per chunk) raises there too. ENABLE_CHAT_RESPONSE_STREAM_INPLACE_APPEND = os.getenv('ENABLE_CHAT_RESPONSE_STREAM_INPLACE_APPEND', 'False').lower() == 'true' # When enabled, uses a hardcoded extension-to-MIME dictionary as a last-resort diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 173f4a222e..3dca01d8bb 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -324,7 +324,7 @@ def append_to_text_field(item: dict, key: str, value: str) -> None: return # Opt-in: dropping the dict's reference lets CPython extend an unshared str - # in place. An allocation failure can leave the field empty. + # in place. Only a host that is already out of memory can leave the field empty. text = item[key] item[key] = '' text += value