diff --git a/ovos_core/intent_services/__init__.py b/ovos_core/intent_services/__init__.py index 98bccaa7932..4815984eb99 100644 --- a/ovos_core/intent_services/__init__.py +++ b/ovos_core/intent_services/__init__.py @@ -73,6 +73,9 @@ def __init__(self, bus): self.common_qa = CommonQAService(bus) self.utterance_plugins = UtteranceTransformersService(bus, config=config) self.metadata_plugins = MetadataTransformersService(bus, config=config) + # connection SessionManager to the bus, + # this will sync default session across all components + SessionManager.connect_to_bus(self.bus) self.bus.on('register_vocab', self.handle_register_vocab) self.bus.on('register_intent', self.handle_register_intent) @@ -273,11 +276,18 @@ def handle_utterance(self, message): stopwatch = Stopwatch() + # get session + sess = SessionManager.get(message) + if sess.session_id == "default": + # Default session, check if it needs to be (re)-created + if sess.expired(): + sess = SessionManager.reset_default_session() + sess.lang = lang + # match match = None with stopwatch: # Loop through the matching functions until a match is found. - sess = SessionManager.get(message) for match_func in self.get_pipeline(session=sess): match = match_func(utterances, lang, message) if match: @@ -287,7 +297,7 @@ def handle_utterance(self, message): message.data["utterance"] = match.utterance if match.skill_id: - self.converse.activate_skill(match.skill_id) + self.converse.activate_skill(match.skill_id, message=message) message.context["skill_id"] = match.skill_id # If the service didn't report back the skill_id it # takes on the responsibility of making the skill "active" @@ -306,6 +316,9 @@ def handle_utterance(self, message): # Ask politely for forgiveness for failing in this vital task self.send_complete_intent_failure(message) + # sync any changes made to the default session, eg by ConverseService + if sess.session_id == "default": + SessionManager.sync() return match, message.context, stopwatch except Exception as err: diff --git a/requirements/requirements.txt b/requirements/requirements.txt index cc4c4736b48..217656e37f2 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -6,7 +6,7 @@ combo-lock>=0.2.2, <0.3 padacioso~=0.2, >=0.2.1a8 adapt-parser>=1.0.0, <2.0.0 -ovos_bus_client~=0.0,>=0.0.6a7 +ovos_bus_client~=0.0,>=0.0.6a8 ovos-utils<0.1.0, >=0.0.35a7 ovos-plugin-manager<0.1.0, >=0.0.24a5 ovos-config~=0.0,>=0.0.11a9