Commit Graph

116 Commits (32ac6a83da6635d406d4f3651930baec5d7e4e83)

Author SHA1 Message Date
Matthew D. Scholefield 403aeb9360 Upgrade Padatious to 0.3.2 which brings in entity support 2017-10-03 12:17:02 -05:00
Jarbas f5806b86c5 fallback start, end, failure messages (#1108)
==== Tech Notes ====
Add mycroft.skill.handler.start and mycroft.skill.handler.complete to fallback handler. handler in data field will be called "fallback" upon completion the used handler will be reported in the "fallback_handler" data entry.

* fix

* pep8

* fallback handler name
2017-09-28 17:53:57 +02:00
Åke Forslund 1d0e65dfb1 Fix update_event and cancel_event methods
====  Tech Notes ====
update_event and cancel_event did not use a name unique to the skill
forcing the user to build it themselves. Now the unique name is
constructed in the method _unique_name() for all event scheduling
methods.
2017-09-28 02:24:34 -05:00
Matthew D. Scholefield 5e392f34aa Optimize imports
Remove unused imports and group local vs external alphabetically
2017-09-18 16:07:50 -05:00
Matthew D. Scholefield cfdc405da5 Add new LOG class 2017-09-18 13:56:06 -05:00
Åke Forslund cf9aafa765 Add data to the information of running skill
==== Tech Notes ====
The handler name (including class if available) is sent along in the
data field. If an exception is raised an exception field in the data is
added with minor information of the problem.
2017-09-14 16:38:54 -05:00
Åke Forslund 1d6da7d37d Add messages for skill handler's starting/stopping
====  Tech Notes ====
Add message bus messages when a skill handler is starting to execute and
a separate message for when skill handler completes. Usable if grouping
speech in certain clients for example. Can also be of use for audio
ducking and similar processes.

==== Protocol Notes ====
Adds the following messages:
mycroft.skill.handler.start
mycroft.skill.handler.complete
2017-09-14 16:38:54 -05:00
Åke Forslund a33c07621b Reduce configuration loading in module scope
====  Tech Notes ====
Autoloading configuration in submodules is bad for testing purposes and
should be reduced. It takes time and adds the possibility of altering
the base conditions for the tests

- mycroft/skills/core: global configuration moved to main.py
- mycroft/messagebus/client/ws.py global config moved to __init__ of
Websocket
- client/speech/mic.py global config moved to ResponsiveRecognizer
__init__() method
- client/enclosure/display_manager.py
 - get_ipc_directory() called in methods where used
2017-09-13 12:51:48 -05:00
Åke Forslund 5ddf1250ab Fix issues discovered by codacity. 2017-09-12 15:07:20 -05:00
Åke Forslund df8fe650c8 Update docstrings after PR feedback 2017-09-12 15:07:20 -05:00
Åke Forslund f1c6912d43 Add event scheduler
====  Tech Notes ====
A single thread handling scheduled events. The skills interact with this
using the self.schedule_event() self.schedule_repeating_event
self.update_event() and self.remove_event().

This is an improvement over scheduledSkill since each skill creates
their own Thread and has to handle storing/restoring scheduled events
between starts.

All pending events are stored in a json file at shutdown for future
sessions.

====  Documentation Notes ====
Needs to be documented

==== Protocol Notes ====
new messagebus event handlers:
- mycroft.scheduler.schedule_event
- mycroft.scheduler.remove_event
- mycroft.scheduler.update_event
2017-09-12 15:07:20 -05:00
Åke 27dba0c786 Merge branch 'dev' into make_message_optional 2017-09-01 21:29:16 +02:00
Åke Forslund 2881b1842f Setting storage is no longer forced at shutdown
Risk of corruption if the skill service was terminated while settings
were written was determined to be greater than any benefit from this.
2017-09-01 10:45:05 -05:00
Åke Forslund 0782064819 Write settings dict to disk more frequently
====  Tech Notes ====
After an intent has been handled the settings will be stored if any changes are detected.

A force option was added to the .store method of the settings class which always writes the dict to disk even if no changes has been made. This is used during shutdown.
2017-09-01 10:45:05 -05:00
Michael Nguyen 995d67e612 Merge pull request #1018 from forslund/bugfix/issue-1014
Bugfix/issue 1014
2017-08-31 15:59:32 -05:00
Michael Nguyen 2dc6e47bea Merge pull request #1020 from forslund/bugfix/issue-1019
Fix expect response for speak_dialog
2017-08-31 15:58:54 -05:00
Åke Forslund 144e9c016c Automatically find skill directory in __init__
====  Tech Notes ====
Previously the _dir parameter was poplated from the skill loader between calling __init__() and initialize(). The skill path can however be gleaned from with in the __init__() of MycroftSkill.

Doing this makes the settings accessable from __init__() as well and will allow a more straight forward usage.
2017-08-31 15:54:46 -05:00
Åke Forslund b44b2914af Fix expect response for speak_dialog
==== Fixed Issues ====
the expect_response pararmeter is now correctly passed along to
self.speak()

====  Tech Notes ====
NONE - explain new algorithms in detail, tool changes, etc.

====  Documentation Notes ====
NONE - description of a new feature or notes on behavior changes

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2017-08-25 14:26:33 +02:00
Åke Forslund 3be861cee2 Fix trailing references causing memory leak
==== Fixed Issues ====

====  Tech Notes ====
This PR corrects a couple of small issues led to skills being left in memory when.
- Handler for `stop.mycroft` weren't removed from event emitter when
skill shut down. Now is added using `self.add_event()`
- registered intent list `self.events` created a circular reference that
python couldn't resolve a live so this is now deleted at shutdown
- Timers in scheduled skills weren't terminated properly. Now if the
timer is alive it will be joined

====  Documentation Notes ====
Registring event handlers should use `self.add_event` instead of
`self.emitter.on()` To make sure they are cleaned up when skill is
terminated.

==== Localization Notes ====
NONE - point to new strings, language specific functions, etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk, etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, APIs, etc.
2017-08-25 11:15:50 +02:00
ginanjar azie 41c7921bbb make message parameter on intent handler optional 2017-08-24 11:15:25 +07:00
Åke Forslund dea591e9b8 Cleanup imports 2017-08-22 08:45:06 +02:00
Åke Forslund e61b516ea1 Add more docstrings 2017-08-22 07:40:28 +02:00
Åke Forslund 12bf78cd5f Move funcs only used in skill_tester from core.py
====  Tech Notes ====
Some functions have been orphaned in core.py and are only used in the
tests. To clean up these have been moved to where they're used.
2017-08-21 15:59:48 +02:00
Åke Forslund ebcbbd3a60 Fix skill container
==== Fixed Issues ====
#1007

====  Tech Notes ====
The converse system changed the api for the load_skill() function this
since the skill_container wasn't updated accordingly it stopped working.
This PR makes updates the container to use the new interface.
2017-08-21 15:09:51 +02:00
Jarbas f04f5107e7 small fix (#1005) Rebase issues with converse method
====  Tech Notes  ====
- Use skill id instead of name
- use time() function correctly
2017-08-21 09:18:01 +02:00
Michael Nguyen f2f5925b09 fixing issue 998 2017-08-17 22:05:49 -05:00
Matthew D. Scholefield 9de5a13659 Add decorator support for intent files and fix regular decorator 2017-08-17 16:01:11 -05:00
Matthew D. Scholefield 69d17a373b Create PadatiousService and add padatious to requirements.txt 2017-08-17 16:01:11 -05:00
Jarbas d661b8d2e7 Add conversational support to skill system
The most recently used skills now have an opportunity to preview all
utterances before they hit the intent system.

==== Tech Notes ====
Skills get a preview in the order of activation -- most recent first --
and if they can consume the utterance or ignore it. If consumed,
processing stops. If ignored, the next most recent skill gets a shot
at it. Finally, if no skill consumes it the intent system takes over,
running as it always has.

Skills remain "active" for 5 minutes after last use.

A skill achieves this by implementing the converse() method, e.g.

def def converse(self, utterances, lang="en-us"):
    if .... :
        return True  # handled, consume utterance
    else:
        return False  # not for this skill, pass it along
2017-08-17 12:09:17 -05:00
Åke Forslund 811cbdb6da Remove requrement to build Intents
====  Tech Notes ====
IntentBuilder objects always need to be built into an Intent to be
usable in mycroft. Since this is always neccessary the code doing this
can be moved so users don't need to do this step.

This commit makes the `register_intent()` method check the handler
argument type, if it's an IntentBuilder object it builds the Intent, if
it's an Intent it continues as normal, if it's any other type it will
raise a ValueError
2017-08-17 11:49:00 +02:00
harika 4c3dd3aa7c Updating skill_tester to automate skills testing(regression) 2017-08-17 02:05:02 -05:00
harika 632df2a498 Update tests 2017-08-17 02:05:02 -05:00
Åke Forslund f19ac28a5c Add some safety to the add/remove context methods
====  Tech Notes ====
Invalid context or word arguments will now raise ValueError
2017-08-15 21:27:19 -05:00
Åke Forslund b9a054e669 Manual context injection
A skill can inject context to enable and disable intent handlers
automatically depending on previous conversation.
2017-08-15 21:27:19 -05:00
Åke Forslund 1d7d02161d Add a default shutdown method for fallback skills
====  Tech Notes ====
Adds a shutdown method that removes all handlers registered by the
current instance.
2017-08-09 14:24:21 +02:00
Åke Forslund c363662b67 Remove need for name parameter
====  Tech Notes ====
If name is not provided the class name will be used
2017-08-09 14:18:14 +02:00
Åke Forslund 7f5f1ac2c1 Fix double __init__ in MycroftSkill
==== Fixed Issues ====
NONE

====  Tech Notes ====
During earlier rebase it seems like a double instance of __init__ got
into MycroftSkill.

====  Documentation Notes ====
NONE

==== Localization Notes ====
NONE

==== Environment Notes ====
NONE

==== Protocol Notes ====
NONE
2017-08-09 13:31:55 +02:00
Matthew D. Scholefield 6f1a2dbe55 Convert static methods in FallbackSkill to class methods
This makes it more concise and mimics the behavior of self, but for static methods
2017-08-03 13:49:32 -05:00
Matthew D. Scholefield 3b6942a250 Move intent fallback behavior to new FallbackSkill base class 2017-08-03 13:49:32 -05:00
Matthew D. Scholefield 4afe6687c4 Fix intent failed messages before running fallbacks 2017-08-03 13:49:02 -05:00
Matthew D. Scholefield a86f0478a4 Add intent fallback system
Also removes multi utterence intent fail. Only makes sense to emit an intent_failure regardless of the amount of intents
2017-08-03 13:49:02 -05:00
Åke Forslund db6127a0ed Catch exceptions in user provided stop() method
==== Fixed Issues ====
#960

====  Tech Notes ====
The messagebus handler for "mycroft.stop" halts and exits if an
exception occurs in any methods that are registered to that name. The
handler executes the stop() method that's provided by the user and is
not verified. To ensure that other skills are unaffected exceptions in
the user provided method are caught.

====  Documentation Notes ====
NONE - things like description of a new feature or notes on behavior
changes

==== Localization Notes ====
NONE - point out new strings, functions needing international versions,
etc.

==== Environment Notes ====
NONE - new package requirements, new files being written to disk,
etc.

==== Protocol Notes ====
NONE - message types added or changed, new signals, etc.
2017-08-03 14:14:31 +02:00
Åke e7c55aaa43 Merge pull request #933 from MycroftAI/feature/skill-configuration
Feature/skill configuration
2017-08-02 08:57:28 +02:00
Michael Nguyen 37ada28dbd refactored skill settings and fixed test 2017-07-27 16:28:32 -05:00
Steve Penrod e8e0853825 Merge pull request #838 from MycroftAI/feature/display_state_manager
Feature/display state manager
2017-07-21 19:58:07 -05:00
Åke Forslund 6f41964796 Make name parameter optional.
==== Fixed Issues ====

==== Tech Notes ====
Uses supplied name parameter if present, otherwise uses name of class.

==== Documentation Notes ====
The skill creation documentation should mention that the name parameter
is only an option.

==== Localization Notes ====
NONE

==== Environment Notes ====
NONE

=== Protocol Notes ====
NONE
2017-07-19 16:47:26 -05:00
Matthew D. Scholefield 90aff68034 Reverting "Add intent fallback system (#899)"
This is because this will break wolfra alpha skill unless they update
skills, but if they update before getting the new version, it will also
break wolfram

This reverts commit 6ca4161335.
2017-07-14 17:53:42 -05:00
Matthew D. Scholefield 6ca4161335 Add intent fallback system (#899)
* Create new FallbackSkill base class for implementing fallback behavior
Also removes multi utterance intent fail. Only makes sense to emit an intent_failure regardless of the amount of intents
2017-07-14 17:27:26 -05:00
Michael Nguyen f62a771e28 merge changes 2017-07-06 16:59:26 -05:00
Michael Nguyen f361392628 Merge branch 'dev' of https://github.com/MycroftAI/mycroft-core into feature/skill-configuration 2017-07-06 12:40:50 -05:00