feat: visual emotion recognition agent #54
@@ -111,25 +111,27 @@ class VisualEmotionRecognitionAgent(BaseAgent):
|
||||
if not emotions_to_add and not emotions_to_remove:
|
||||
return
|
||||
|
||||
emotion_beliefs = []
|
||||
emotion_beliefs_remove = []
|
||||
# Remove emotions that have disappeared
|
||||
for emotion in emotions_to_remove:
|
||||
self.logger.info(f"Emotion '{emotion}' has disappeared.")
|
||||
try:
|
||||
emotion_beliefs.append(Belief(name="emotion", arguments=[emotion], remove=True))
|
||||
emotion_beliefs_remove.append(Belief(name="emotion", arguments=[emotion], remove=True))
|
||||
except ValidationError:
|
||||
self.logger.warning("Invalid belief for emotion removal: %s", emotion)
|
||||
|
||||
emotion_beliefs_add = []
|
||||
# Add new emotions that have appeared
|
||||
for emotion in emotions_to_add:
|
||||
self.logger.info(f"New emotion detected: '{emotion}'")
|
||||
try:
|
||||
emotion_beliefs.append(Belief(name="emotion", arguments=[emotion]))
|
||||
emotion_beliefs_add.append(Belief(name="emotion", arguments=[emotion]))
|
||||
except ValidationError:
|
||||
self.logger.warning("Invalid belief for new emotion: %s", emotion)
|
||||
|
||||
beliefs_list = [b.model_dump() for b in emotion_beliefs]
|
||||
payload = {"beliefs": beliefs_list}
|
||||
beliefs_list_add = [b.model_dump() for b in emotion_beliefs_add]
|
||||
beliefs_list_remove = [b.model_dump() for b in emotion_beliefs_remove]
|
||||
payload = {"create": beliefs_list_add, "delete": beliefs_list_remove, "replace": []}
|
||||
|
||||
message = InternalMessage(
|
||||
to=settings.agent_settings.bdi_core_name,
|
||||
|
||||
Reference in New Issue
Block a user