diff options
author | Toran Bruce Richards <toran.richards@gmail.com> | 2023-04-30 16:43:49 +1200 |
---|---|---|
committer | Toran Bruce Richards <toran.richards@gmail.com> | 2023-04-30 16:43:49 +1200 |
commit | f287282e8ca27b9eef25725dfef3dabddfbd8d5c (patch) | |
tree | 8e83430da99f4f778f361f797ee4e8764144897c | |
parent | Remove thoughts from memory summarisation. (diff) | |
download | Auto-GPT-f287282e8ca27b9eef25725dfef3dabddfbd8d5c.tar.gz Auto-GPT-f287282e8ca27b9eef25725dfef3dabddfbd8d5c.tar.bz2 Auto-GPT-f287282e8ca27b9eef25725dfef3dabddfbd8d5c.zip |
fix broken partial commit.
-rw-r--r-- | autogpt/memory_management/summary_memory.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/autogpt/memory_management/summary_memory.py b/autogpt/memory_management/summary_memory.py index 685b33ba3..a43ba4dae 100644 --- a/autogpt/memory_management/summary_memory.py +++ b/autogpt/memory_management/summary_memory.py @@ -57,12 +57,18 @@ def update_running_summary(current_memory: str, new_events: List[Dict]) -> str: """ # Replace "assistant" with "you". This produces much better first person past tense results. for event in new_events: + if event["role"].lower() == "assistant": + event["role"] = "you" # Remove "thoughts" dictionary from "content" content_dict = json.loads(event["content"]) if "thoughts" in content_dict: del content_dict["thoughts"] event["content"] = json.dumps(content_dict) elif event["role"].lower() == "system": + event["role"] = "your computer" + # Delete all user messages + elif event["role"] == "user": + new_events.remove(event) # This can happen at any point during execturion, not just the beginning if (len(new_events) == 0): |