Commit Graph

78 Commits (refactor/python-detect)

Author SHA1 Message Date
Åke Forslund f709bb9a1e Use IntentServiceInterface in MycroftSkill.register_vocabulary()
This moves the message logic for adapt keyword registration into a single location.
2021-09-26 19:15:21 +02:00
Chris Veilleux 18cb28088d Added comments to document race condition 2021-07-06 13:48:52 -05:00
Kris Gesling e75a05557b docstring cleanup 2021-05-11 15:10:32 +09:30
Kris Gesling 6327ac5dbb
Upgrade Lingua Franca to v0.4.1 (#2890)
**Update Lingua Franca to v0.4.1**

The update from Lingua Franca v0.2.x to v0.4.x includes few
breaking changes.
- Some API methods have been updated.
- Mycroft-core tests have been updated to reflect improvements in
  Lingua Franca's formatting and parsing.
- add LF default lang setting method to config.locale 
  including warning that this method will change in the future
- Add TODO's for 21.08 - moving more methods to LF
- simplify loading and setting default of languages in Skills service
- Remove unneeded wrappers for Lingua Franca functions
- Fix documentation of format and parse utils
- Fix test warnings
2021-05-08 08:34:02 +09:30
Kris Gesling 356288a38f
Merge pull request #2863 from forslund/feature/mycroft-bus-client
Utilize the mycroft-messagebus-client module
2021-03-31 21:22:31 +09:30
Åke Forslund 9acf5b7592 Utilize the mycroft-messagebus-client module
This utilizes the shared messagebus client implemented in the
mycroft-messagebus-client.
2021-03-22 06:31:50 +01:00
Kris Gesling cee879e7a4 Add exact optional param to voc_match
This adds the option to require an exact match of vocab. It sourced
from the Playback Control Skill.
2021-03-16 16:05:06 +09:30
Kris Gesling 0587c5d75e
Merge pull request #2856 from forslund/bugfix/stray-print
Remove stray print
2021-03-15 12:24:28 +09:30
Åke Forslund 29fd50324b Remove stray print 2021-03-14 09:32:45 +01:00
Kris Gesling ec00631c4b
Merge pull request #2813 from NeonAndrii/feature/issue-2812
Issue-2812 - Allow overridden converse methods to accept messages
2021-03-11 15:25:24 +09:30
Kris Gesling 3679eb1355
Merge pull request #2838 from forslund/test/get_response-tests
get response tests
2021-03-10 23:44:48 +09:30
neonandrii d69b61afb6 Issue-2812 - Allow overridden converse methods to accept messages - FIX: PEP8-line-too-long issue in MycroftSkill.converse - change required signature in MycroftSkill.converse(). 2021-02-23 14:44:12 +02:00
Åke Forslund 3a6ca30b33 Fix selecting last opt by number in ask_selection()
Fix off by one issue preventing the last option to be selected by
number.
2021-02-14 17:19:31 +01:00
Åke Forslund 7f3b4e1795 Add skill_api_method decorator
The api methods are now much easier to use, almost transparent. The
current caveat is that only "standarad" python types are acceptable
(int, float, str, list, bool, None) due to the json serialization.

- api methods are now created with the skill_api_method decorator
- both arguments and keyword arguments are sent to the api method
instead of the message object
- api methods now uses a normal return statement instead of having to
handle creating response messages on the bus.

For example if the datetime skill wants to make the datetime string
fetchable simply add the skill_api_method decorator to the
get_display_date method.

    @skill_api_method
    def get_display_date(self, day=None, location=None):
        """Returns the date and time as a string."""
        [...]

The methods return value will be sent back to the caller and can be used
from a skill through

        datetime = SkillApi.get('mycroft-date-time.mycroftai')
        self.log.info(datetime.get_display_date())
2021-02-06 17:57:19 +01:00
Åke Forslund df02bf22b4 Add skill api.
The skill api allows skills to define a public api which can easily be
accessed by other skills over the message bus just as easy as working
with a normal object.

The skill api object is generated from the skill's public_api property. It's a dict where each key is turned into a method on the api object. The method is defined as
  "api_method": {
    "type": message type string
    "func": handler method
    "help": help string for cli
  }

Example skill:

class Test2(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self)
        self.public_api = {
            'speak': {
                'type': 't2.speak',
                'func': self.handle_speak,
                'help': 'speak the test sentence\nand another line\n\nlast'
            },
            'speak2': {
                'type': 't2.speak2',
                'func': self.handle_speak2,
                'help': 'speak the other sentence'
            }
        }

    def handle_speak(self, message):
        self.speak('This is a test')
        self.bus.emit(message.response(data=None))

    def handle_speak2(self, message):
        self.speak('This is another test')
        self.bus.emit(message.response(data=None))
2021-02-06 17:55:34 +01:00
neonandrii fb84658e5d Issue-2812 - Allow overridden converse methods to accept messages - FIX: PEP8-line-too-long issue in MycroftSkill.converse 2021-01-26 19:27:33 +02:00
neonandrii 171b266ec1 Issue-2812 - Allow overridden converse methods to accept messages - modified the signature check in SkillManager.handle_converse_request and MycroftSkill.converse, and resolving PEP8 issues 2021-01-25 21:00:06 +02:00
neonandrii 416eebfee7 Issue-2812 - Allow overridden converse methods to accept messages - adding default message=None to MycroftSkill.converse and changing the signature check in the skill manager. 2021-01-22 17:16:22 +02:00
katridi a185a9a4bf
Issue-2567 - Fixing not initialized dialog_render (#2685)
Fixes #2567
2020-09-15 22:10:39 +09:30
Åke Forslund 6abfca67a6 Fix settings changed check after skill handler
Make self._initial_settings have an unique copy of the settings and not
a reference to the original ones.
2020-08-09 08:50:44 +02:00
Bart Ribbers 01900e5a29 Check the skill directory and XDG_CONFIG_DIR for settings 2020-05-15 11:45:13 +02:00
Åke Forslund d7cab332fe Add skill to speak meta information 2020-03-23 11:41:13 +01:00
Åke Forslund d9d5f57a4f Add meta information about the speech dialog
Provides meta data such as dialog used and data that was inserted.
2020-03-23 11:41:13 +01:00
Åke Forslund 5867b4fe2e Remove debug logging of stop message context 2020-02-27 14:33:34 +01:00
Chris Veilleux baf194c556 remove deprecated Settings class and any code in core that references it. 2020-02-27 08:07:07 +01:00
Åke Forslund ef76f685bf Only register for stop events if skill uses them. 2020-02-26 07:25:45 +01:00
jarbasal f209afb021 Move dig_for_message to messagebus submodule 2020-02-15 15:35:43 +01:00
jarbasal fc9e254eef common iot message context 2020-02-15 15:35:43 +01:00
jarbasal f4a96e6c22 Update Unittests and fix pep8 2020-02-15 15:35:43 +01:00
jarbasal cc8029a357 pass context in scheduled events 2020-02-15 15:35:43 +01:00
jarbasal 0a560602c7 Use forward to send messages in MycroftSkill 2020-02-15 12:50:49 +01:00
Åke d269a49a16
Merge pull request #2422 from forslund/refactor/dialog
Refactor mycroft.dialog
2020-02-07 08:33:25 +01:00
Åke Forslund f759903dcb Deprecate DialogLoader class
The DialogLoader class has been replaced by the simpler load_dialogs
function.
2020-02-05 17:04:37 +01:00
Åke Forslund 9563bff162 Add readthedocs docs for settings_change_callback 2020-01-15 08:39:15 +01:00
Åke Forslund 555478c33f Add self.root_dir to readthedocs documentation 2020-01-03 10:45:39 +01:00
Philipp Fischbeck 3f73fb50af
Fix typo in MycroftSkill documentation
Change "https://https://" to "https://"
2019-12-15 16:42:41 +01:00
domcross 7af161fd03 Fallback to 'en-us' when resource fails
When mycroft_skill.find_resource fails to load a resource for self.lang
fall back to lang 'en-us'
as most skills/resources are available in english by default.

==== Fixed Issues ====
2019-12-05 10:21:54 +01:00
Åke 6bd6441da2
Merge pull request #2393 from MycroftAI/feature/geolocation-api
Feature/geolocation api
2019-11-26 11:10:05 +01:00
Chris Veilleux 183649ac5e Merge remote-tracking branch 'remotes/origin/dev' into feature/geolocation-api 2019-10-31 13:11:58 -05:00
Åke Forslund d4a7193fe8 Remove circular reference during skill shutdown
This cleans up the extra skills references making the ref count trigger
correctly.
2019-10-31 09:38:46 +01:00
Åke Forslund 4bf0e89fb5 Update docstrings to match behaviour 2019-10-17 11:33:25 +02:00
ChanceNCounter 738ba6cf00 edit for pep8 compliance (#15) 2019-10-17 11:07:51 +02:00
jarbasal 978ece53ca feat/ask_selection 2019-10-17 11:07:51 +02:00
Åke Forslund 08d38dea75 Remove event before running event handler
Allow events to reschedule themselves. The reference is removed before
the handler is executed to not remove anything added by the handler.
2019-10-04 18:29:11 +02:00
Åke 15233f8929
Merge pull request #2336 from forslund/feature/load-skill-settings-once
Remove duplicate load of skill settings
2019-10-03 19:46:11 +02:00
Åke Forslund 425feb0590 Store correct function for once events
The handler was always stored even when the event was a once event and
thus was wrapped in once_wrapper.

This handles the once correctly.
2019-09-30 13:31:53 +02:00
Åke Forslund 9254ee0229 Remove duplicate load of skill settings
Instead of loading skill settings from disk twice, a copy is made into the
_initial_settings member after load.
2019-09-29 18:39:07 +02:00
Chris Veilleux eca875558a added log message and docstring to help demystify regex intent handling 2019-09-28 12:21:28 -05:00
Åke 6c228d00a9
Merge pull request #2320 from MycroftAI/bugfixes/skills-manifest
Bugfixes/skills manifest
2019-09-20 22:57:57 +02:00
Åke Forslund c6b1e3dc92 Make logging a little easier to decipher 2019-09-20 12:20:46 +02:00