From 3e10e2ace2f33d967605e4d9885bd75045c7d198 Mon Sep 17 00:00:00 2001 From: Nadine Ganz Date: Sat, 20 Sep 2025 16:44:14 +0200 Subject: [PATCH 1/2] Add context in italien to chatbot --- Viagg-io/Assets/BehaviourTrees/2.6-Castello.bt.txt | 1 - Viagg-io/Assets/Packages/MyBT/BTC/BTC.cs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Viagg-io/Assets/BehaviourTrees/2.6-Castello.bt.txt b/Viagg-io/Assets/BehaviourTrees/2.6-Castello.bt.txt index 86542297..13a1a161 100644 --- a/Viagg-io/Assets/BehaviourTrees/2.6-Castello.bt.txt +++ b/Viagg-io/Assets/BehaviourTrees/2.6-Castello.bt.txt @@ -766,7 +766,6 @@ Tree("26_Castello_Castelli_di_Bellinzona_Castelli_Bot_Interaktion") { BTC.Run("MediaPlayer.VIDEOS.CastelliBotInterak_F1") BTC.Run("MediaPlayer.VIDEOS.CastelliBotInterak_FIdle02") - BTC.SetSpeechRecognitionLanguage("de-DE") // TODO: muss geloescht werden am Ende BTC.StartChatbotConversation() BTC.ChatbotConversationEnded() BTC.SpeechOutputEnded() diff --git a/Viagg-io/Assets/Packages/MyBT/BTC/BTC.cs b/Viagg-io/Assets/Packages/MyBT/BTC/BTC.cs index 3a51f6bd..23fc670e 100644 --- a/Viagg-io/Assets/Packages/MyBT/BTC/BTC.cs +++ b/Viagg-io/Assets/Packages/MyBT/BTC/BTC.cs @@ -1032,12 +1032,12 @@ public class BTC : MonoBehaviour { { if (Task.getState == NodeState.FirstRun) { - string languageCode = "de-DE"; - string instructions = "Antworte immer auf Deutsch."; - string context = "Du bist ein allwissendes Wesen, welches ausschliesslich Fragen zu Astronomie beantwortet. Sag . Antworte immer so kurz wie möglich. Das Gespräch started jetzt."; + string languageCode = "it-IT"; + string instructions = "Rispondi sempre in italiano. Rispondi in lingua colloquiale al livelli di competenza A2 di quadro comune europeo di riferimento per la conoscenza delle lingue."; + string context = "Sei un essere onnisciente che risponde esclusivamente a domande sulla cultura e la storia del Cantone Ticino e dei Castelli di Bellinzona. Parla . Rispondi sempre nel modo più conciso possibile. Suddividi le domande in passaggi più piccoli e sviluppale. Chiedi se hanno capito tutto. La conversazione ha inizio."; int maxRoundTrips = 5; float maxSilenceBeforeTimeOut = 10; - string outroText = $"Vielen Dank, das Gespräch ist nun beendet"; + string outroText = $"Grazie mille, la conversazione è finita."; _onConversationInitiatedEventTriggered = false; _speechMng.StartConversation(languageCode, instructions, context, maxRoundTrips, maxSilenceBeforeTimeOut, outroText); From ffcc78bdad2e5d9cf921f0be20e3d9cbb4854425 Mon Sep 17 00:00:00 2001 From: Nadine Ganz Date: Sat, 20 Sep 2025 19:27:26 +0200 Subject: [PATCH 2/2] Update speech package, rename button handmenu --- Viagg-io/Assets/Prefabs/UI/_HANDMENU.prefab | 2 +- .../{ => Scripts}/VRCameraIdleMotion.cs | 0 .../{ => Scripts}/VRCameraIdleMotion.cs.meta | 0 .../afca/ViaggioAI/Prefabs/ViaggioAI.prefab | 4 +-- .../Scripts/AIServices/ConversationService.cs | 25 ++++++++----------- .../AIServices/IntentRecognitionService.cs | 18 +++---------- .../AIServices/SpeechRecognitionService.cs | 5 ++-- .../ViaggioAI/ControllerInputEventHandler.cs | 2 +- .../Scripts/ViaggioAI/ViaggioAIManager.cs | 17 +------------ 9 files changed, 23 insertions(+), 50 deletions(-) rename Viagg-io/Assets/{ => Scripts}/VRCameraIdleMotion.cs (100%) rename Viagg-io/Assets/{ => Scripts}/VRCameraIdleMotion.cs.meta (100%) mode change 100644 => 100755 Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/IntentRecognitionService.cs mode change 100644 => 100755 Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/SpeechRecognitionService.cs mode change 100755 => 100644 Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ViaggioAIManager.cs diff --git a/Viagg-io/Assets/Prefabs/UI/_HANDMENU.prefab b/Viagg-io/Assets/Prefabs/UI/_HANDMENU.prefab index e77bddaa..03fa86e2 100644 --- a/Viagg-io/Assets/Prefabs/UI/_HANDMENU.prefab +++ b/Viagg-io/Assets/Prefabs/UI/_HANDMENU.prefab @@ -6413,7 +6413,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "Level w\xE4hlen\r" + m_text: "Szene w\xE4hlen\r" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 0d97ed6259f90444b8da67a4e5872245, type: 2} m_sharedMaterial: {fileID: -2574710329927910322, guid: 0d97ed6259f90444b8da67a4e5872245, type: 2} diff --git a/Viagg-io/Assets/VRCameraIdleMotion.cs b/Viagg-io/Assets/Scripts/VRCameraIdleMotion.cs similarity index 100% rename from Viagg-io/Assets/VRCameraIdleMotion.cs rename to Viagg-io/Assets/Scripts/VRCameraIdleMotion.cs diff --git a/Viagg-io/Assets/VRCameraIdleMotion.cs.meta b/Viagg-io/Assets/Scripts/VRCameraIdleMotion.cs.meta similarity index 100% rename from Viagg-io/Assets/VRCameraIdleMotion.cs.meta rename to Viagg-io/Assets/Scripts/VRCameraIdleMotion.cs.meta diff --git a/Viagg-io/Assets/afca/ViaggioAI/Prefabs/ViaggioAI.prefab b/Viagg-io/Assets/afca/ViaggioAI/Prefabs/ViaggioAI.prefab index fdf80578..ff3938e9 100755 --- a/Viagg-io/Assets/afca/ViaggioAI/Prefabs/ViaggioAI.prefab +++ b/Viagg-io/Assets/afca/ViaggioAI/Prefabs/ViaggioAI.prefab @@ -2267,7 +2267,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &187118496494279981 Transform: m_ObjectHideFlags: 0 @@ -2676,7 +2676,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: v. 2024.09.1601 + m_text: v. 2025.09.1601 m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} diff --git a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/ConversationService.cs b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/ConversationService.cs index 07c3fbfa..257fbbbb 100644 --- a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/ConversationService.cs +++ b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/ConversationService.cs @@ -126,13 +126,8 @@ public class ConversationService : MonoBehaviour #region Events - private async void subscribeToEvents() - { - while (vaim == null) - { - await System.Threading.Tasks.Task.Delay(10); - } - + private void subscribeToEvents() + { vaim.SpeechRecognitionService.OnPartialTranscriptionChangedEvent += this.onPartialTranscriptionChanged; vaim.SpeechRecognitionService.OnFullTranscriptionChangedEvent += this.onFullTranscriptionChangedEvent; @@ -241,6 +236,7 @@ public class ConversationService : MonoBehaviour public async void StartConversation(string _languageCode, string _instructions, string _context, int _maxRoundtrips, float _maxSilenceBeforeTimeOut, string _outroText) { this.logIfInDebugMode($"Starting new conversation"); + ViaggioAIManager.Instance.soundEffectsEnabled = false; this.languageCode = _languageCode; this.instructions = _instructions; @@ -265,7 +261,8 @@ public class ConversationService : MonoBehaviour vaim.SpeechRecognitionService.StopListening(); this.openAIServices_Conversation.Stop(); - this.ConversationState = EConversationState.NotStarted; + this.ConversationState = EConversationState.NotStarted; + ViaggioAIManager.Instance.soundEffectsEnabled = true; } #endregion @@ -362,13 +359,13 @@ public class ConversationService : MonoBehaviour { this.logIfInDebugMode("Stopping conversation"); - this.OnConversationEndedEvent?.Invoke(this, $"Conversation stopped"); - - if (timeOut) - { - vaim.SpeechSynthesizerService.Synthesize(this.outroText, this.languageCode); + this.OnConversationEndedEvent?.Invoke(this, $"Conversation stopped"); + + if (timeOut) + { + vaim.SpeechSynthesizerService.Synthesize(this.outroText, this.languageCode); } - + this.ConversationState = EConversationState.Ended; vaim.StopConversation(); diff --git a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/IntentRecognitionService.cs b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/IntentRecognitionService.cs old mode 100644 new mode 100755 index 36f9f005..b2b4695a --- a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/IntentRecognitionService.cs +++ b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/IntentRecognitionService.cs @@ -101,13 +101,8 @@ public class IntentRecognitionService : MonoBehaviour #region Private Events - private async void subscribeToEvents() - { - while (vaim == null) - { - await System.Threading.Tasks.Task.Delay(10); - } - + private void subscribeToEvents() + { vaim.OnViaggioAIStateChangedEvent += this.onViaggioAIStateChanged; vaim.SpeechRecognitionService.OnFullTranscriptionChangedEvent += this.onFullTranscriptionChanged; @@ -193,13 +188,8 @@ public class IntentRecognitionService : MonoBehaviour #region Private Functions - private async void updateOpenAIServiceState() - { - while (vaim == null) - { - await System.Threading.Tasks.Task.Delay(10); - } - + private void updateOpenAIServiceState() + { bool newIsEnabled = vaim.ViaggioAIState == EViaggioAIState.IntentRecognition; this.openAIServices_IntentRecognizer.enabled = newIsEnabled; diff --git a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/SpeechRecognitionService.cs b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/SpeechRecognitionService.cs old mode 100644 new mode 100755 index 3c75694c..5c7fa717 --- a/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/SpeechRecognitionService.cs +++ b/Viagg-io/Assets/afca/ViaggioAI/Scripts/AIServices/SpeechRecognitionService.cs @@ -214,9 +214,10 @@ public class SpeechRecognitionService : MonoBehaviour lock (threadLocker) { this.SpeechRecognitionState = ESpeechRecognitionState.Listening; - } - + } + vaim.PlayAudioIfEnabled(this.startedListeningClip); + recognizer.SpeechStartDetected += this.speechRecognizer_SpeechStartDetected; recognizer.Recognizing += this.speechRecognizer_Recognizing; diff --git a/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ControllerInputEventHandler.cs b/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ControllerInputEventHandler.cs index 384b7e1c..d43cf805 100644 --- a/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ControllerInputEventHandler.cs +++ b/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ControllerInputEventHandler.cs @@ -55,7 +55,7 @@ public class ControllerInputEventHandler : MonoBehaviour #region Private Functions private void checkForInput() - { + { return; } diff --git a/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ViaggioAIManager.cs b/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ViaggioAIManager.cs old mode 100755 new mode 100644 index 20ccf658..038e3742 --- a/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ViaggioAIManager.cs +++ b/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ViaggioAIManager.cs @@ -28,7 +28,7 @@ public class ViaggioAIManager : MonoBehaviour private bool debugModeIsActive; [SerializeField] - private bool soundEffectsEnabled; + public bool soundEffectsEnabled; [Header("Scene Objects")] [SerializeField] @@ -115,28 +115,13 @@ public class ViaggioAIManager : MonoBehaviour void OnEnable() { - this.subscribeToEvents(); - this.initWithDelay(); } - void OnDisable() - { - this.unsubscribeFromEvents(); - } - #endregion #region Private Events - private void subscribeToEvents() - { - } - - private void unsubscribeFromEvents() - { - } - #endregion #region Public Events