Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[voice] Update dialog processing #2693

Merged
merged 1 commit into from
Jan 30, 2022
Merged

Conversation

lolodomo
Copy link
Contributor

@lolodomo lolodomo commented Jan 16, 2022

Related to #2688

Updated methods startDialog
New method stopDialog
Null annotations added to the class DialogProcessor

Allow translation of sentences "said" by the dialog processor in case of error

2 console commands added to start and stop a dialog

Enhanced integration tests

Signed-off-by: Laurent Garnier lg.hc@free.fr

@lolodomo lolodomo requested a review from a team as a code owner January 16, 2022 21:45
@lolodomo lolodomo changed the title [WIP][voice] Update the handling of a dialog [WIP][voice] Update dialog processing Jan 17, 2022
@lolodomo lolodomo force-pushed the voice_dialog branch 20 times, most recently from 9b5e80c to f9d3fed Compare January 22, 2022 12:33
@lolodomo lolodomo changed the title [WIP][voice] Update dialog processing [voice] Update dialog processing Jan 22, 2022
@lolodomo
Copy link
Contributor Author

@cweitkamp @wborn @kaikreuzer : this PR is now ready for review.

@lolodomo
Copy link
Contributor Author

I have to mention that it is a API breaking change as the public VoiceManager interface is enhanced with a new method.

@cweitkamp cweitkamp added the enhancement An enhancement or new feature of the Core label Jan 24, 2022
@lolodomo
Copy link
Contributor Author

@openhab/core-maintainers : I would appreciate if this could be included in 3.3M1. This is important as first keyword spotting and Speech-to-Text addons will be included.

@kaikreuzer
Copy link
Member

Hey @lolodomo, many thanks for your work on this.
Unfortunately, I wasn't available this week and will also have limited time the coming days. I'll happily review it, but I'm afraid, I cannot go through it in time for 3.3.0.M1 (which would mean it needs to be merged today).

I have to mention that it is a API breaking change as the public VoiceManager interface is enhanced with a new method.

As it is only adding a method (and new runtime exceptions to existing methods), this is not breaking for API consumers, which is fine. This interface is not meant to be implemented by anybody else, it's only meant to be used.

Related to openhab#2688

Updated methods startDialog
New method stopDialog
Null annotations added to the class DialogProcessor

Allow translation of sentences "said" by the dialog processor in case of error

2 console commands added to start and stop a dialog

Enhanced integration tests

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have slightly postponed M1, I just found the time for the review, @lolodomo!
Just a few very minor remarks that should be quick and easy to address (and which could also be done as a follow-up PR in case you cannot address them within the next 2 hours).

private void closeStreamKS() {
AudioStream stream = streamKS;
if (stream != null) {
// Due to the current implementation of JavaSoundAudioSource, the stream is not closed as it would
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate a bit (in the comment) on what the exact problem is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is explained in issue #2702

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a link to this issue in the code then, please?
It looks as this should/could be easily fixed as well, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will, but I can't do it immediately. (not at home)

Yes a fix is apparently easy. The idea was to discuss the issue with the author code. Maybe you are the author? I don't remember and I have not checked.

if (stream != null) {
// Due to the current implementation of JavaSoundAudioSource, the stream is not closed as it would
// lead to problem
// try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to then remove the commented code here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean we keep the method the comment but not the commented code. Ok with that.

private void closeStreamSTT() {
AudioStream stream = streamSTT;
if (stream != null) {
// Due to the current implementation of JavaSoundAudioSource, the stream is not closed as it would
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@@ -65,7 +76,11 @@ public VoiceConsoleCommandExtension(final @Reference VoiceManager voiceManager,
public List<String> getUsages() {
return List.of(buildCommandUsage(SUBCMD_SAY + " <text>", "speaks a text"),
buildCommandUsage(SUBCMD_INTERPRET + " <command>", "interprets a human language command"),
buildCommandUsage(SUBCMD_VOICES, "lists available voices of the TTS services"));
buildCommandUsage(SUBCMD_VOICES, "lists available voices of the TTS services"),
buildCommandUsage(SUBCMD_START_DIALOG + " [<source> <interpreter> <sink> <keyword>]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks as if you allow a flexible number of parameters in the implementation, so the usage might better be something like

[<source> [<interpreter> [<sink> [<keyword>]]]]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right.

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lolodomo Ok, I merge it now so that it is in 3.3 M1 and you can do a follow-up PR.

@kaikreuzer kaikreuzer merged commit 8f0dd94 into openhab:main Jan 30, 2022
@kaikreuzer kaikreuzer added this to the 3.3 milestone Jan 30, 2022
@lolodomo
Copy link
Contributor Author

Thank you Kai

@lolodomo lolodomo deleted the voice_dialog branch January 30, 2022 17:35
lolodomo added a commit to lolodomo/openhab-core that referenced this pull request Feb 3, 2022
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
kaikreuzer pushed a commit that referenced this pull request Feb 3, 2022
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
Related to openhab#2688

Updated methods startDialog
New method stopDialog
Null annotations added to the class DialogProcessor

Allow translation of sentences "said" by the dialog processor in case of error

2 console commands added to start and stop a dialog

Enhanced integration tests

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
GitOrigin-RevId: 8f0dd94
splatch pushed a commit to ConnectorIO/copybara-hab-core that referenced this pull request Jul 12, 2023
…nhab#2729)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
GitOrigin-RevId: 3e94dd6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants