mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
enh: CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE
This commit is contained in:
parent
a068ba88de
commit
4e9c75be50
2 changed files with 21 additions and 1 deletions
|
|
@ -487,6 +487,25 @@ else:
|
|||
MODELS_CACHE_TTL = 1
|
||||
|
||||
|
||||
####################################
|
||||
# CHAT
|
||||
####################################
|
||||
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE = os.environ.get(
|
||||
"CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE", "1"
|
||||
)
|
||||
|
||||
if CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE == "":
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE = 1
|
||||
else:
|
||||
try:
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE = int(
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE
|
||||
)
|
||||
except Exception:
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE = 1
|
||||
|
||||
|
||||
####################################
|
||||
# WEBSOCKET SUPPORT
|
||||
####################################
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ from open_webui.config import (
|
|||
from open_webui.env import (
|
||||
SRC_LOG_LEVELS,
|
||||
GLOBAL_LOG_LEVEL,
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE,
|
||||
BYPASS_MODEL_ACCESS_CONTROL,
|
||||
ENABLE_REALTIME_CHAT_SAVE,
|
||||
)
|
||||
|
|
@ -1819,7 +1820,7 @@ async def process_chat_response(
|
|||
|
||||
delta_count = 0
|
||||
delta_chunk_size = max(
|
||||
1,
|
||||
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE,
|
||||
int(
|
||||
metadata.get("params", {}).get("stream_delta_chunk_size")
|
||||
or 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue