🐛 fix(memories.py): fix condition to add extra fields in MemoryFrontendNode class

 feat(memories.py): add show attribute to entity_store field in MemoryFrontendNode class
The condition to add extra fields in the MemoryFrontendNode class has been fixed to correctly check if any of the base classes are in a list of base message classes. Additionally, the show attribute has been added to the entity_store field in the MemoryFrontendNode class to control its visibility.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-29 18:37:52 -03:00
commit 6fa295b8a8

View file

@ -11,7 +11,8 @@ class MemoryFrontendNode(FrontendNode):
def add_extra_fields(self) -> None:
# chat history should have another way to add common field?
# prevent adding incorect field in ChatMessageHistory
if "BaseChatMessageHistory" in self.base_classes:
base_message_classes = ["BaseEntityStore", "BaseChatMessageHistory"]
if any(base_class in self.base_classes for base_class in base_message_classes):
return
# add return_messages field
@ -77,6 +78,10 @@ class MemoryFrontendNode(FrontendNode):
field.required = False
if field.name == "url":
field.show = True
if field.name == "entity_store":
field.show = True
if name == "SQLiteEntityStore":
field.show = True
class PostgresChatMessageHistoryFrontendNode(MemoryFrontendNode):