🔧 chore(utils.py): use ChatConfig to set streaming option
The first change removes an extra blank line in the ChatManager class. The second change updates the try_setting_streaming_options function to use the ChatConfig class to set the streaming option instead of hardcoding it. This makes the code more modular and easier to maintain.
This commit is contained in:
parent
7c6845b15e
commit
b741853454
2 changed files with 6 additions and 2 deletions
|
|
@ -209,3 +209,5 @@ class ChatManager:
|
|||
except Exception as e:
|
||||
logger.error(e)
|
||||
self.disconnect(client_id)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import os
|
|||
from io import BytesIO
|
||||
import re
|
||||
|
||||
|
||||
import yaml
|
||||
from langchain.base_language import BaseLanguageModel
|
||||
from PIL.Image import Image
|
||||
from langflow.utils.logger import logger
|
||||
from langflow.chat.config import ChatConfig
|
||||
|
||||
|
||||
def load_file_into_dict(file_path: str) -> dict:
|
||||
|
|
@ -49,9 +51,9 @@ def try_setting_streaming_options(langchain_object, websocket):
|
|||
|
||||
if isinstance(llm, BaseLanguageModel):
|
||||
if hasattr(llm, "streaming") and isinstance(llm.streaming, bool):
|
||||
llm.streaming = True
|
||||
llm.streaming = ChatConfig.streaming
|
||||
elif hasattr(llm, "stream") and isinstance(llm.stream, bool):
|
||||
llm.stream = True
|
||||
llm.stream = ChatConfig.streaming
|
||||
|
||||
return langchain_object
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue