From d3b72f395832902a4876e300d3b4d8d3627aee47 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Tue, 25 Apr 2023 22:12:06 -0300 Subject: [PATCH] refactor(chat_manager.py): add comment to clarify iteration direction in get_file_responses method --- src/backend/langflow/api/chat_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/langflow/api/chat_manager.py b/src/backend/langflow/api/chat_manager.py index cafa6bb5f..e52e99832 100644 --- a/src/backend/langflow/api/chat_manager.py +++ b/src/backend/langflow/api/chat_manager.py @@ -124,7 +124,8 @@ class ChatManager: history = self.chat_history.get_history(client_id, filter=False) file_responses = [] if history: - for msg in history: + # Iterate backwards through the history + for msg in reversed(history): if isinstance(msg, FileResponse): file_responses.append(msg) if msg.type == "start":