summaryrefslogtreecommitdiffstats
path: root/agl_service_voiceagent/client.py
diff options
context:
space:
mode:
authorMalik Talha <talhamalik727x@gmail.com>2023-10-29 20:52:29 +0500
committerMalik Talha <talhamalik727x@gmail.com>2023-10-29 20:52:29 +0500
commit42a03d2550f60a8064078f19a743afb944f9ff69 (patch)
treec9a7b3d028737d5fecd2e05f69e1c744810ed5fb /agl_service_voiceagent/client.py
parenta10c988b5480ca5b937a2793b450cfa01f569d76 (diff)
Update voice agent service
Add new features such as an option to load service using an external config file, enhanced kuksa client, and a more robust mapper. Signed-off-by: Malik Talha <talhamalik727x@gmail.com> Change-Id: Iba3cfd234c0aabad67b293669d456bb73d8e3135
Diffstat (limited to 'agl_service_voiceagent/client.py')
-rw-r--r--agl_service_voiceagent/client.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/agl_service_voiceagent/client.py b/agl_service_voiceagent/client.py
index 9b2e0a0..922e08c 100644
--- a/agl_service_voiceagent/client.py
+++ b/agl_service_voiceagent/client.py
@@ -20,14 +20,8 @@ from agl_service_voiceagent.generated import voice_agent_pb2
from agl_service_voiceagent.generated import voice_agent_pb2_grpc
from agl_service_voiceagent.utils.config import get_config_value
-# following code is only reqired for logging
-import logging
-logging.basicConfig()
-logging.getLogger("grpc").setLevel(logging.DEBUG)
-
-SERVER_URL = get_config_value('SERVER_ADDRESS') + ":" + str(get_config_value('SERVER_PORT'))
-
def run_client(mode, nlu_model):
+ SERVER_URL = get_config_value('SERVER_ADDRESS') + ":" + str(get_config_value('SERVER_PORT'))
nlu_model = voice_agent_pb2.SNIPS if nlu_model == "snips" else voice_agent_pb2.RASA
print("Starting Voice Agent Client...")
print(f"Client connecting to URL: {SERVER_URL}")
@@ -73,6 +67,12 @@ def run_client(mode, nlu_model):
print("Command:", record_result.command)
print("Status:", status)
print("Intent:", record_result.intent)
+ intent_slots = []
for slot in record_result.intent_slots:
print("Slot Name:", slot.name)
- print("Slot Value:", slot.value) \ No newline at end of file
+ print("Slot Value:", slot.value)
+ i_slot = voice_agent_pb2.IntentSlot(name=slot.name, value=slot.value)
+ intent_slots.append(i_slot)
+
+ exec_voice_command_request = voice_agent_pb2.ExecuteInput(intent=record_result.intent, intent_slots=intent_slots)
+ response = stub.ExecuteVoiceCommand(exec_voice_command_request) \ No newline at end of file