From 64889c4c525c4c66fb74dd703a1cbc0375bc405d Mon Sep 17 00:00:00 2001 From: Malik Talha Date: Thu, 2 Nov 2023 03:29:04 +0500 Subject: Update voice agent related recipes Change the SRCURI to use gerrit repos. Update agl-service-voicegent recipe to correctly package all the required content. Add recipe for another en-us vosk model. Add service files for RASA and Voice Agent server. Bug-AGL: SPEC-4906 Change-Id: Ic9f77386ff5c545c2a80433dd538c94bd8763e9e Signed-off-by: Malik Talha --- .../agl-flutter-voiceassistant_git.bb | 27 --------------- .../voiceagent-app/flutter-voiceassistant_git.bb | 28 ++++++++++++++++ .../agl-service-voiceagent_git.bb | 39 ++++++++++++++++++++-- .../files/agl-service-voiceagent.service | 11 ++++++ 4 files changed, 76 insertions(+), 29 deletions(-) delete mode 100644 meta-offline-voice-agent/recipes-assistant/voiceagent-app/agl-flutter-voiceassistant_git.bb create mode 100644 meta-offline-voice-agent/recipes-assistant/voiceagent-app/flutter-voiceassistant_git.bb create mode 100644 meta-offline-voice-agent/recipes-assistant/voiceagent-service/files/agl-service-voiceagent.service (limited to 'meta-offline-voice-agent/recipes-assistant') diff --git a/meta-offline-voice-agent/recipes-assistant/voiceagent-app/agl-flutter-voiceassistant_git.bb b/meta-offline-voice-agent/recipes-assistant/voiceagent-app/agl-flutter-voiceassistant_git.bb deleted file mode 100644 index 036e1fe6..00000000 --- a/meta-offline-voice-agent/recipes-assistant/voiceagent-app/agl-flutter-voiceassistant_git.bb +++ /dev/null @@ -1,27 +0,0 @@ -SUMMARY = "AGL Voice Assistant" -DESCRIPTION = "Offline voice assistant app designed for Automotive Grade Linux (AGL)." -HOMEPAGE = "https://github.com/malik727/agl-flutter-voiceassistant" -BUGTRACKER = "https://github.com/malik727/agl-flutter-voiceassistant/issues" -SECTION = "graphics" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE;md5=4202492ed9afcab3aaecc4a9ec32adb2" - -SRC_URI = "git://github.com/malik727/agl-flutter-voiceassistant.git;protocol=https;branch=main \ - " - -SRCREV = "${AUTOREV}" -S = "${WORKDIR}/git" - -inherit agl-app flutter-app - -# flutter-app -############# -PUBSPEC_APPNAME = "agl_flutter_voiceassistant" -FLUTTER_APPLICATION_INSTALL_PREFIX = "/flutter" -FLUTTER_BUILD_ARGS = "bundle -v" - -# agl-app -######### -AGL_APP_TEMPLATE = "agl-app-flutter" -AGL_APP_ID = "agl_flutter_voiceassistant" -AGL_APP_NAME = "AGL Voice Assistant" \ No newline at end of file diff --git a/meta-offline-voice-agent/recipes-assistant/voiceagent-app/flutter-voiceassistant_git.bb b/meta-offline-voice-agent/recipes-assistant/voiceagent-app/flutter-voiceassistant_git.bb new file mode 100644 index 00000000..edcb9fe4 --- /dev/null +++ b/meta-offline-voice-agent/recipes-assistant/voiceagent-app/flutter-voiceassistant_git.bb @@ -0,0 +1,28 @@ +SUMMARY = "Voice Assistant" +DESCRIPTION = "Offline voice assistant app designed for Automotive Grade Linux (AGL)." +HOMEPAGE = "https://github.com/malik727/agl-flutter-voiceassistant" +BUGTRACKER = "https://github.com/malik727/agl-flutter-voiceassistant/issues" +SECTION = "graphics" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4202492ed9afcab3aaecc4a9ec32adb2" + +SRC_URI = "\ + git://gerrit.automotivelinux.org/gerrit/apps/flutter-speechrecognition-demo;protocol=https;branch=${AGL_BRANCH} \ + " + +SRCREV = "${AUTOREV}" +S = "${WORKDIR}/git" + +inherit agl-app flutter-app + +# flutter-app +############# +PUBSPEC_APPNAME = "flutter_voiceassistant" +FLUTTER_APPLICATION_INSTALL_PREFIX = "/flutter" +FLUTTER_BUILD_ARGS = "bundle -v" + +# agl-app +######### +AGL_APP_TEMPLATE = "agl-app-flutter" +AGL_APP_ID = "flutter_voiceassistant" +AGL_APP_NAME = "Voice Assistant" \ No newline at end of file diff --git a/meta-offline-voice-agent/recipes-assistant/voiceagent-service/agl-service-voiceagent_git.bb b/meta-offline-voice-agent/recipes-assistant/voiceagent-service/agl-service-voiceagent_git.bb index 615ec64f..6fa560cc 100644 --- a/meta-offline-voice-agent/recipes-assistant/voiceagent-service/agl-service-voiceagent_git.bb +++ b/meta-offline-voice-agent/recipes-assistant/voiceagent-service/agl-service-voiceagent_git.bb @@ -4,23 +4,56 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://LICENSE;md5=4202492ed9afcab3aaecc4a9ec32adb2" SRC_URI = " \ - git://github.com/malik727/agl-service-voiceagent;protocol=https;branch=main \ + file://agl-service-voiceagent.service \ + git://gerrit.automotivelinux.org/gerrit/apps/agl-service-voiceagent;protocol=https;branch=${AGL_BRANCH} " SRCREV = "${AUTOREV}" S = "${WORKDIR}/git" +# Speech to Text Model Name, use 'vosk-model-en-us-0.22' for better performance +VOSK_STT_MODEL_NAME ?= "vosk-model-small-en-us-0.15" +# Wake Word Detection Model Name +VOSK_WWD_MODEL_NAME ?= "vosk-model-small-en-us-0.15" +WAKE_WORD ?= "hello auto" + DEPENDS += " \ python3 \ python3-setuptools-native \ python3-grpcio-tools-native \ " -inherit setuptools3 +inherit setuptools3 systemd + +SYSTEMD_SERVICE:${PN} = "agl-service-voiceagent.service" do_compile:prepend() { # Generate proto files and move them to 'generated/' directory python3 -m grpc_tools.protoc -I${S}/agl_service_voiceagent/protos --python_out=${S}/agl_service_voiceagent/generated --grpc_python_out=${S}/agl_service_voiceagent/generated voice_agent.proto + + # Replace all placeholders with actual values + sed -i 's|PYTHON_DIR|${PYTHON_SITEPACKAGES_DIR}|g' ${S}/agl_service_voiceagent/config.ini + sed -i 's|VOSK_STT_MODEL_NAME|${VOSK_STT_MODEL_NAME}|g' ${S}/agl_service_voiceagent/config.ini + sed -i 's|VOSK_WWD_MODEL_NAME|${VOSK_WWD_MODEL_NAME}|g' ${S}/agl_service_voiceagent/config.ini + sed -i 's|WAKE_WORD_VALUE|${WAKE_WORD}|g' ${S}/agl_service_voiceagent/config.ini + + # Keep Note that if you make any change to the value of above variables, you'll need to perform: + # 'bitbake -c cleanall agl-service-voiceagent' + # and compile this package again to see your changes reflected. +} + +do_install:append() { + # Create the destination directory if it doesn't exist + install -d ${D}/usr/share/nlu/ + + # Copy the 'mappings' folder to the destination directory + cp -R ${WORKDIR}/git/mappings ${D}/usr/share/nlu/ + + # Initialize our service definition + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/agl-service-voiceagent.service ${D}${systemd_system_unitdir} + fi } RDEPENDS:${PN} += " \ @@ -33,3 +66,5 @@ RDEPENDS:${PN} += " \ python3-snips-inference-agl \ vosk \ " + +FILES:${PN} += "/usr/share/nlu/" \ No newline at end of file diff --git a/meta-offline-voice-agent/recipes-assistant/voiceagent-service/files/agl-service-voiceagent.service b/meta-offline-voice-agent/recipes-assistant/voiceagent-service/files/agl-service-voiceagent.service new file mode 100644 index 00000000..54139431 --- /dev/null +++ b/meta-offline-voice-agent/recipes-assistant/voiceagent-service/files/agl-service-voiceagent.service @@ -0,0 +1,11 @@ +[Unit] +Description=AGL Voice Agent Service +After=network.target +Requires=rasa-service.service + +[Service] +ExecStart=/usr/bin/voiceagent-service run-server --default +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file -- cgit 1.2.3-korg