Skip to content

Commit

Permalink
Fix/optional adapt (#19)
Browse files Browse the repository at this point in the history
* remove old files

* fix/optional_adapt

Co-authored-by: jarbasai <[email protected]>
  • Loading branch information
JarbasAl and JarbasAl authored May 7, 2022
1 parent 48b9c47 commit c4f755f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ovos_workshop/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from os import listdir
from os.path import isdir, exists

from adapt.intent import IntentBuilder, Intent

from mycroft_bus_client.message import dig_for_message
from ovos_utils import get_handler_name
from ovos_utils.configuration import read_mycroft_config
Expand Down Expand Up @@ -40,6 +40,11 @@ def pronounce_number(n, *args, **kwargs):

def extract_number(*args, **kwargs):
return None
try:
from adapt.intent import IntentBuilder, Intent
except ImportError:
# adapt is optional, OVOSAbstractApplication might not use intents
IntentBuilder = Intent = None


class OVOSAbstractApplication:
Expand Down Expand Up @@ -856,10 +861,10 @@ def _register_decorated(self):

def register_intent_layer(self, layer_name, intent_list):
for intent_file in intent_list:
if isinstance(intent_file, IntentBuilder):
if IntentBuilder is not None and isinstance(intent_file, IntentBuilder):
intent = intent_file.build()
name = intent.name
elif isinstance(intent_file, Intent):
elif Intent is not None and isinstance(intent_file, Intent):
name = intent_file.name
else:
name = f'{self.skill_id}:{intent_file}'
Expand Down Expand Up @@ -926,12 +931,12 @@ def register_intent(self, intent_parser, handler):
file to parse utterance for the handler.
handler (func): function to register with intent
"""
if isinstance(intent_parser, IntentBuilder):
if IntentBuilder is not None and isinstance(intent_parser, IntentBuilder):
intent_parser = intent_parser.build()
if (isinstance(intent_parser, str) and
intent_parser.endswith('.intent')):
return self.register_intent_file(intent_parser, handler)
elif not isinstance(intent_parser, Intent):
elif not Intent or not isinstance(intent_parser, Intent):
raise ValueError('"' + str(intent_parser) + '" is not an Intent')

return self._register_adapt_intent(intent_parser, handler)
Expand Down
Binary file removed screenshots/audio_service.png
Binary file not shown.
Binary file removed screenshots/missing_seekbar.png
Binary file not shown.
Binary file removed screenshots/simple_video.png
Binary file not shown.

0 comments on commit c4f755f

Please sign in to comment.