Commit Graph

403 Commits (dev)

Author SHA1 Message Date
Åke ab242a2c82
Handle multiple intents with the same name (#2921)
* Add check for duplicate adapt intents

There are two cases, duplicated named intent and duplicated anonymous intent.

A named intent will cause a ValueError exception notifying the skill
author that there is a collision.

An anonymous intent will silently derive a new name and use that
instead of the default generated one.

* Add tests for intent collisions

* Make enable/disable intent handle the new exception

The enable/disable intent did not mark an intent as detached, instead it
remained in the list of intents after disabling in the IntentServiceInterface
to be retrieved when the intent should be re-enabled.

This moves detached intents into a list of detached intents to so they
won't cause the double enable exception.

* Add move logic to find if intent is detached

MycroftSkill.enable_intent() will now check if the intent is detached
before trying to re-enable it.

* Lock updates of intents

This should avoid some race conditions that may occur if multiple
threads tries to enable / disable intents
2022-11-23 15:52:56 +09:30
Åke 5f4c68e583
Don't overwrite invalid json in config (#2881)
* Separate tests of LocalConf into new test class

* Do not overwrite configs with malformed json

If a config file is loaded and is invalid saves to that file will not be
possible until it's manually restored. The store accepts a force flag to
override this protection.

The method returns True if the store succeeded so call sites can
verbally report the issue as well.
2022-03-07 10:03:10 +09:30
Åke e7ddd51256
TTS playback queue singleton (#3055)
* fix issues when remote excepts out

* Remove explicit clear_cache from MimicTTS

* Updates for using singleton TTS playback thread

- Cache is called on all tts's registered as using the thread
- Begin audio and end audio is handled by the playback thread
- Further changes from self.playback to TTS.playback for consistency

* Remove redundant try/except

* Consolidate general and TTS-specific sentence splitting

This performs all sentence-splitting at the same stage. This fixes a
subtle issue where a TTS splits a sentence into chunks and throws an
error on only one of those chunks. The fallback would generate a
sentence for the original un-chunked sentence. possibly saying the same
parts twice.

This also pre-compiles the regexes used to speed things up a bit.

Co-authored-by: Ken <ken.smith@mycroft.ai>
2022-03-02 09:59:57 +09:30
Kris Gesling 89cfad7943
Check if GUI is connected rather than maintain list of platforms (#3025)
* Check if GUI is connected rather than maintain list of platforms

There are already many Mycroft platforms that have GUIs
and this will only grow. We want to know if the device
has a GUI connected rather than if it is in a pre-defined
list of platforms.

* Create a mock GUI with a settable connected attribute
2021-11-24 14:51:10 +09:30
Gaëtan Trellu 0247b3a4b5
[log_format] Add an option to change the log format (#3016)
* [log_format] Add an option to change the log format

Hacing an option to change the log format could be useful when logs
are shipped into an aggregator such as Elasticsearch.

The current format is very hard to parse.

* [log_format] Set default Formatter

Because mycroft.configuration.Configuration() class import LOG class,
a default Formatter have to be defined before import the
mycroft.configuration.Configuration() class.
2021-10-29 14:59:22 +09:30
Kris Gesling 2a6bb90c9f
Merge pull request #2963 from forslund/feature/update-adapt-keyword-registration-message
Update key names in adapt keyword registration message
2021-09-27 10:30:12 +09:30
Å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
Åke Forslund 189267b6f6 Minor cleanup of test case for keyword registration 2021-09-26 19:15:21 +02:00
Åke Forslund 693100e8c6 Match keyword entity terms in Mycroft with Adapt
This changes the internally used names for entities and entity values when
sent on the messagebus and used interanally in the intent service from start / end to entity_value and entity_type.

This makes the terminology easier to understand and follow across into Adapt.

The old terms are still included and usable for compatibility but should be
removed in an upcoming major release (22.02).
2021-09-26 19:15:17 +02:00
ken-mycroft 5e81e2747b
Improve confidence calculation for Common Query (#2986)
* Improve confidence calculation

* Add actual noise words file

* Update expected test confidence levels

Co-authored-by: Kris Gesling <kris.gesling@mycroft.ai>
2021-09-20 16:33:28 +09:30
Bart Ribbers e20443b824 Use XDG Base directories for settings, cache and runtime data
Improve deprecation warning message
2021-08-05 10:04:45 +02:00
Kris Gesling a794db0c9a Make network tests configurable
Previously test URIs were hardcoded.
They can now be configured in mycroft.conf
2021-08-02 21:00:05 +09:30
Åke Forslund 0ae02b5939 Fix TTS using the returned path 2021-07-02 08:34:03 +02:00
Kris Gesling 0394568704 Use returned TTS audio file path
This reverts an unintentional breaking change.
A TTS engine may return a different file path than was requested.
This again uses the returned path but adds a deprecation warning
that this behaviour will no longer be supported in an upcoming release.

Fixes #2929
2021-06-29 21:53:53 +09:30
Åke Forslund 4799caa696 Add test cases for tts cache __contains__ 2021-06-10 09:33:12 +02:00
Kris Gesling 1cc25da144
Merge pull request #2898 from MycroftAI/bugfix/docstring-cleanup
Cleanup of documentation
2021-06-01 12:16:44 +09:30
Kris Gesling 891784a454
Merge pull request #2888 from forslund/refactor/mimic_tts-dont-load-config-on-import
Refactor mimic_tts to not load config when importing
2021-05-28 15:24:13 +09:30
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 088f563ad9
Merge pull request #2892 from MycroftAI/bugfix/consistent-temp-dir
Replace hardcoded use of /tmp directory
2021-05-08 07:28:27 +09:30
Kris Gesling 5d3b9d479b Fix test for expected TypeError 2021-05-07 15:34:37 +09:30
Kris Gesling dc4c146f69 Fix assigning of queue without existing loader 2021-05-06 10:11:39 +09:30
Kris Gesling 0fb90edd28 Rename to get_temp_path and add docstring 2021-04-30 16:49:59 +09:30
Kris Gesling d9adf73db7 Add unit test for create_temp_file 2021-04-30 16:21:13 +09:30
dzekem christa 77d3969dc3 newline added 2021-04-30 14:48:15 +09:30
dzekem christa 241a8b89df pep8 error rectified 2021-04-30 14:48:15 +09:30
dzekem christa 4547752c66 minor errors fixed 2021-04-30 14:48:15 +09:30
dzekem christa 7765d11224 ran autopep8 2021-04-30 14:48:15 +09:30
dzekem christa 3f745c52ad created temp path function 2021-04-30 14:47:49 +09:30
dzekem christa d659179645 more fixes 2021-04-30 14:46:36 +09:30
dzekem christa 621b4ab650 spaces added and uniformity in code 2021-04-30 14:46:36 +09:30
dzekem christa 9252158829 rectified pep8 issues 2021-04-30 14:46:36 +09:30
dzekem christa 32f666edd4 Issue-2727 - fixing hard coded /tmp 2021-04-30 14:46:36 +09:30
dzekem christa a174c3c822 replaced hard coded /tmp 2021-04-30 14:46:36 +09:30
Åke Forslund 5d68309523 Refactor mimic_tts to not load config when importing
Hitting the entire configuration fetching routine with call to the
backend is not polite to do when just importing the file. This moves the
config lookup out of the global scope and into special functions for
finding the mimic binary and looking up the data path for the subscriber
voices.
2021-04-28 22:31:10 +02:00
Åke Forslund bea3bac2bf Make mimic get_tts() return phonemes pre-parsed
This makes the phonemes json de/encodable like mimic2
2021-04-05 08:28:38 +02:00
Åke Forslund 0b857e92f9 Sync tts cache dict of cached sentences on curate
This will make sure the dict of caches gets updated when curate_cache
removes files.
2021-03-21 13:33:08 +01:00
Åke Forslund 7bd27eb5df Make curate_cache() return removed files 2021-03-21 12:47:57 +01:00
Kris Gesling 7d3cb2d53e
Merge pull request #2869 from forslund/refactor/tts-cache-curation
Move TTS cache curation to TextToSpeechCache
2021-03-19 11:41:54 +09:30
Åke Forslund 9b4544dc7d Move cache curation to TextToSpeechCache 2021-03-18 23:02:26 +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
Chris Veilleux bf2670c890
Merge pull request #2853 from MycroftAI/feature/consolidate_tts_cache
Consolidate TTS cache logic
2021-03-11 16:25:19 -06:00
Kris Gesling a399b19fd6
Merge pull request #2849 from forslund/refactor/clean-intent-service
Remove intent-service backwards compatibilities
2021-03-11 15:26:26 +09:30
Chris Veilleux ea013b26af Fixed failing unit test. 2021-03-10 21:16:34 -06:00
Chris Veilleux 86febca6a3 Fixed a bug passing None to an instance of Path 2021-03-10 15:35:38 -06:00
Chris Veilleux 5e90940896 new code to consolidate TTS cache handling into one module. 2021-03-10 13:38:17 -06:00
Kris Gesling 3679eb1355
Merge pull request #2838 from forslund/test/get_response-tests
get response tests
2021-03-10 23:44:48 +09:30
Åke Forslund 203e1fc740 Remove intent-service backwards compatibility
- Remove unused ContextManager import from mycroft.skills.intent_service
- Remove Old 'intent_failure' -> fallback handler
- Remove handling of fallback messages without the fallback_range
parameter
2021-03-07 12:59:59 +01:00
Kris Gesling 38839a1489
Merge pull request #1822 from forslund/feature/skill-api
Feature/skill api
2021-02-23 10:03:17 +09:30
Åke Forslund d724720b21 Basic tests for get_response based skill methods
- get_response
- ask_yesno
- ask_selection
2021-02-14 17:18:20 +01:00