Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

feat: revert

莘权 马cc89f3b7263e
diff --git a/metagpt/memory/memory.py b/metagpt/memory/memory.py
index 1a8003fba..a96aaf1be 100644
--- a/metagpt/memory/memory.py
+++ b/metagpt/memory/memory.py
@@ -4,8 +4,6 @@
@Time : 2023/5/20 12:15
@Author : alexanderwu
@File : memory.py
-@Modified By: mashenquan, 2023-8-7. Modified get_by_actions() to support for dynamically generated Action classes
- at runtime.
"""
from collections import defaultdict
from typing import Iterable, Type
@@ -82,20 +80,8 @@ class Memory:
def get_by_actions(self, actions: Iterable[Type[Action]]) -> list[Message]:
"""Return all messages triggered by specified Actions"""
rsp = []
- # Using the `type(obj).__name__` approach to support the runtime creation of requirement classes.
- # See `MetaAction.get_action_type()` for more.
- class_names = {type(k).__name__: k for k in self.index.keys()}
for action in actions:
- if type(action).__name__ not in class_names:
+ if action not in self.index:
continue
- key = class_names[type(action).__name__]
- rsp += self.index[key]
+ rsp += self.index[action]
return rsp
-
- def get_by_tags(self, tags: list) -> list[Message]:
- """Return messages with specified tags"""
- result = []
- for m in self.storage:
- if m.is_contain_tags(tags):
- result.append(m)
- return result