From b741853454370f4dbb4f4de254a4741f4af4c077 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Tue, 27 Jun 2023 10:16:41 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(utils.py):=20use=20ChatCon?= =?UTF-8?q?fig=20to=20set=20streaming=20option=20The=20first=20change=20re?= =?UTF-8?q?moves=20an=20extra=20blank=20line=20in=20the=20ChatManager=20cl?= =?UTF-8?q?ass.=20The=20second=20change=20updates=20the=20try=5Fsetting=5F?= =?UTF-8?q?streaming=5Foptions=20function=20to=20use=20the=20ChatConfig=20?= =?UTF-8?q?class=20to=20set=20the=20streaming=20option=20instead=20of=20ha?= =?UTF-8?q?rdcoding=20it.=20This=20makes=20the=20code=20more=20modular=20a?= =?UTF-8?q?nd=20easier=20to=20maintain.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/chat/manager.py | 2 ++ src/backend/langflow/interface/utils.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/langflow/chat/manager.py b/src/backend/langflow/chat/manager.py index 4a1b8e77c..b693e00a3 100644 --- a/src/backend/langflow/chat/manager.py +++ b/src/backend/langflow/chat/manager.py @@ -209,3 +209,5 @@ class ChatManager: except Exception as e: logger.error(e) self.disconnect(client_id) + + diff --git a/src/backend/langflow/interface/utils.py b/src/backend/langflow/interface/utils.py index 8d45aa1b1..ff89e92bf 100644 --- a/src/backend/langflow/interface/utils.py +++ b/src/backend/langflow/interface/utils.py @@ -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