From d184d0d2353b2254e85e3df8b15d9b1d079d74aa Mon Sep 17 00:00:00 2001 From: Andres Caicedo <73312784+AndresCdo@users.noreply.github.com> Date: Sat, 6 May 2023 02:14:08 +0200 Subject: [PATCH] Implement Logging of User Input in logs/Debug Folder (#3867) * Adds USER_INPUT_FILE_NAME * Update agent.py * Update agent.py Log only if console_input is not the authorise_key * Reformatting --- autogpt/agent/agent.py | 8 ++++++++ autogpt/log_cycle/log_cycle.py | 1 + 2 files changed, 9 insertions(+) diff --git a/autogpt/agent/agent.py b/autogpt/agent/agent.py index a7ea83239737..e2c44792a994 100644 --- a/autogpt/agent/agent.py +++ b/autogpt/agent/agent.py @@ -11,6 +11,7 @@ from autogpt.log_cycle.log_cycle import ( FULL_MESSAGE_HISTORY_FILE_NAME, NEXT_ACTION_FILE_NAME, + USER_INPUT_FILE_NAME, LogCycleHandler, ) from autogpt.logs import logger, print_assistant_thoughts @@ -215,6 +216,13 @@ def start_interaction_loop(self): else: user_input = console_input command_name = "human_feedback" + self.log_cycle_handler.log_cycle( + self.config.ai_name, + self.created_at, + self.cycle_count, + user_input, + USER_INPUT_FILE_NAME, + ) break if user_input == "GENERATE NEXT COMMAND JSON": diff --git a/autogpt/log_cycle/log_cycle.py b/autogpt/log_cycle/log_cycle.py index 5f2732a8eb4e..cff3ac1a57fb 100644 --- a/autogpt/log_cycle/log_cycle.py +++ b/autogpt/log_cycle/log_cycle.py @@ -10,6 +10,7 @@ NEXT_ACTION_FILE_NAME = "next_action.json" PROMPT_SUMMARY_FILE_NAME = "prompt_summary.json" SUMMARY_FILE_NAME = "summary.txt" +USER_INPUT_FILE_NAME = "user_input.txt" class LogCycleHandler: