From 700304897618f75d481df64191d342e499440150 Mon Sep 17 00:00:00 2001 From: miro Date: Fri, 3 May 2024 23:45:31 +0100 Subject: [PATCH] only activate converse if it returns True --- ovos_workshop/skills/ovos.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ovos_workshop/skills/ovos.py b/ovos_workshop/skills/ovos.py index 92a0a176..24d59d84 100644 --- a/ovos_workshop/skills/ovos.py +++ b/ovos_workshop/skills/ovos.py @@ -1081,7 +1081,7 @@ def _register_system_event_handlers(self): self.add_event("skill.converse.request", self._handle_converse_request, speak_errors=False) self.add_event(f"{self.skill_id}.converse.request", self._handle_converse_request, - speak_errors=False, activation=True) + speak_errors=False) self.add_event(f"{self.skill_id}.activate", self.handle_activate, speak_errors=False) self.add_event(f"{self.skill_id}.deactivate", self.handle_deactivate, @@ -1104,7 +1104,7 @@ def _register_system_event_handlers(self): # TODO: deprecate 0.0.9 self.add_event("skill.converse.get_response", self.__handle_get_response, speak_errors=False) self.add_event(f"{self.skill_id}.converse.get_response", self.__handle_get_response, - speak_errors=False, activation=True) + speak_errors=False) def _send_public_api(self, message: Message): """ @@ -1225,6 +1225,9 @@ def _handle_converse_request(self, message: Message): "lang": message.data['lang']} kwargs = {k: v for k, v in kwargs.items() if k in params} result = self.converse(**kwargs) + if result: + self.activate() # renew activation + self.bus.emit(message.reply('skill.converse.response', {"skill_id": self.skill_id, "result": result})) @@ -1811,12 +1814,6 @@ def __get_response(self, session: Session): Returns: str: user's response or None on a timeout """ - # during alpha 0.0.8 this check is here to handle the edge case missed by the decorator - # TODO - remove before 0.0.8 stable - from ovos_core.version import OVOS_VERSION_ALPHA - if OVOS_VERSION_ALPHA < 40: # introduced in 0.0.8a40 - return self.__get_response_v1() - srcm = dig_for_message() or Message("", context={"source": "skills", "skill_id": self.skill_id}) srcm.context["session"] = session.serialize()