🐛 fix(manager.py): rename variables in ChatManager class to improve clarity and consistency

🐛 fix(utils.py): rename variable in process_graph function to improve clarity and consistency

In the `ChatManager` class, the variable `chat_message` has been renamed to `chat_inputs` to better reflect its purpose of storing the input messages from the chat payload. This improves clarity and consistency within the class.

In the `process_graph` function in `utils.py`, the variable `chat_message` has been renamed to `chat_inputs` to better reflect its purpose of storing the input messages from the chat payload. This improves clarity and consistency within the function.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-28 12:01:36 -03:00
commit 695bc4c9bf
2 changed files with 6 additions and 6 deletions

View file

@ -111,9 +111,9 @@ class ChatManager:
self, client_id: str, payload: Dict, langchain_object: Any
):
# Process the graph data and chat message
chat_message = payload.pop("message", "")
chat_message = ChatMessage(message=chat_message)
self.chat_history.add_message(client_id, chat_message)
chat_inputs = payload.pop("inputs", "")
chat_inputs = ChatMessage(message=chat_inputs)
self.chat_history.add_message(client_id, chat_inputs)
# graph_data = payload
start_resp = ChatResponse(message=None, type="start", intermediate_steps="")
@ -126,7 +126,7 @@ class ChatManager:
result, intermediate_steps = await process_graph(
langchain_object=langchain_object,
chat_message=chat_message,
chat_inputs=chat_inputs,
websocket=self.active_connections[client_id],
)
except Exception as e:

View file

@ -7,7 +7,7 @@ from langflow.utils.logger import logger
async def process_graph(
langchain_object,
chat_message: ChatMessage,
chat_inputs: ChatMessage,
websocket: WebSocket,
):
langchain_object = try_setting_streaming_options(langchain_object, websocket)
@ -23,7 +23,7 @@ async def process_graph(
try:
logger.debug("Generating result and thought")
result, intermediate_steps = await get_result_and_steps(
langchain_object, chat_message.message or "", websocket=websocket
langchain_object, chat_inputs.message or "", websocket=websocket
)
logger.debug("Generated result and intermediate_steps")
return result, intermediate_steps