SpeechInput Features for BT implemented
parent
25116cb8ff
commit
2a0e72ec07
|
@ -10,12 +10,81 @@
|
|||
|
||||
Tree("32_Grotto_Chatbot_Test") {
|
||||
Composite(Sequence) {
|
||||
BTC.GetKeyDown("Return") // Nonna zeile 370
|
||||
|
||||
BTC.AddPossbileSpeechIntent("Story_B_Grotto.Nachfrage_Nonna_Grotto.2", "Ich helfe in der Küche.")
|
||||
BTC.AddPossbileSpeechIntent("Story_B_Grotto.Nachfrage_Nonna_Grotto.4", "Ich warte im Garten auf sie.")
|
||||
BTC.StartSpeechIntentRecognition()
|
||||
BTC.SpeechIntentRecognized()
|
||||
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.2")
|
||||
BTC.GetKeyDown("Return")
|
||||
|
||||
Composite(Race) {
|
||||
Composite(Sequence) {
|
||||
BTC.UserStartedSpeechInput()
|
||||
RunTree("32_Grotto_Chatbot_Test_Compare_Intent")
|
||||
}
|
||||
|
||||
Composite(Sequence) {
|
||||
BTC.Wait(5)
|
||||
BTC.CompareUserSpeechInputStarted(false)
|
||||
RunTree("32_Grotto_Chatbot_Test_No_Answer")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tree("32_Grotto_Chatbot_Test_Compare_Intent") {
|
||||
Composite(Sequence) {
|
||||
Composite(Selector) {
|
||||
Composite(Sequence) {
|
||||
BTC.SpeechIntentRecognized()
|
||||
|
||||
// Intent erkannt
|
||||
Composite(Race) {
|
||||
Composite(Sequence) {
|
||||
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.2")
|
||||
BTC.GetKeyDown("Return")
|
||||
// ...
|
||||
}
|
||||
Composite(Sequence) {
|
||||
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.4")
|
||||
BTC.GetKeyDown("Return")
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Composite(Sequence) {
|
||||
// SpeechIntentRecognized Failed: kein Intent erkannt
|
||||
BTC.GetKeyDown("Tab")
|
||||
BTC.StartSpeechIntentRecognition()
|
||||
// Fallback fehlt, wenn nichts gesagt wird
|
||||
BTC.UserStartedSpeechInput()
|
||||
BTC.SpeechIntentRecognized()
|
||||
|
||||
Composite(Race) {
|
||||
Composite(Sequence) {
|
||||
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.2")
|
||||
BTC.GetKeyDown("Return")
|
||||
// ...
|
||||
}
|
||||
Composite(Sequence) {
|
||||
BTC.CompareIntentID("Story_B_Grotto.Nachfrage_Nonna_Grotto.4")
|
||||
BTC.GetKeyDown("Return")
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback 2mal nicht verstanden: Button klick
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tree("32_Grotto_Chatbot_Test_No_Answer") {
|
||||
Composite(Sequence) {
|
||||
// Bilder Bergell
|
||||
BTC.StopSpeechIntentRecognition()
|
||||
//BTC.Run("LoadScene.NEXT.35Slideshow")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -609,7 +609,7 @@ public class BTC : MonoBehaviour {
|
|||
#endif
|
||||
#endregion
|
||||
|
||||
#region SpeechRecognicer
|
||||
#region SpeechRecognizer
|
||||
private ViaggioAIManager _speechMng { get { return ViaggioAIManager.Instance; } }
|
||||
private RequestDataModel _requestDataModel = new RequestDataModel();
|
||||
private string _recognizedIntentID = "";
|
||||
|
@ -673,6 +673,18 @@ public class BTC : MonoBehaviour {
|
|||
{
|
||||
_onUserSpeechInputStartedEventTriggered = false;
|
||||
_speechMng.StartIntentRecognition(_requestDataModel.PossibleIntents);
|
||||
Task.SetSucceeded();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
[Task]
|
||||
public void UserStartedSpeechInput()
|
||||
{
|
||||
if (Task.getState == NodeState.FirstRun)
|
||||
{
|
||||
_onIntentRecognitionSucceededEventTriggered = false;
|
||||
_onIntentRecognitionFailedEventTriggered = false;
|
||||
}
|
||||
|
||||
if (_onUserSpeechInputStartedEventTriggered)
|
||||
|
@ -685,12 +697,6 @@ public class BTC : MonoBehaviour {
|
|||
[Task]
|
||||
public void SpeechIntentRecognized()
|
||||
{
|
||||
if (Task.getState == NodeState.FirstRun)
|
||||
{
|
||||
_onIntentRecognitionSucceededEventTriggered = false;
|
||||
_onIntentRecognitionFailedEventTriggered = false;
|
||||
}
|
||||
|
||||
if (_onIntentRecognitionSucceededEventTriggered)
|
||||
{
|
||||
Task.SetSucceeded();
|
||||
|
@ -706,6 +712,26 @@ public class BTC : MonoBehaviour {
|
|||
}
|
||||
}
|
||||
|
||||
[Task]
|
||||
public void CompareUserSpeechInputStarted(bool value)
|
||||
{
|
||||
if (Task.getState == NodeState.FirstRun)
|
||||
{
|
||||
if (_onUserSpeechInputStartedEventTriggered == value)
|
||||
{
|
||||
Debug.Log($"CompareUserSpeechInputStarted with {value} = equal");
|
||||
Task.SetSucceeded();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log($"CompareUserSpeechInputStarted with {value} = not equal");
|
||||
Task.SetFailed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Task]
|
||||
public void CompareIntentID(string intentID)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue