Skip to content

Commit a15eb05

Browse files
fix: improved logging warnings related to imports. Before the change, in case s2s was installed and ros2 was not sourced, it was logged that s2s is not installed
1 parent 23351a8 commit a15eb05

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/rai_core/rai/frontend/configurator.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from langchain_ollama import ChatOllama, OllamaEmbeddings
2626
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
2727
import logging
28+
import importlib.util
2829

2930

3031
def get_sound_devices(
@@ -946,27 +947,29 @@ def setup_steps():
946947
step_render = [welcome, model_selection, tracing]
947948

948949
st.session_state.features["s2s"] = True
950+
951+
if importlib.util.find_spec("rai_s2s") is None:
952+
logging.warning(
953+
"Skipping speech recognition, rai_s2s not installed - install `poetry install --with s2s`"
954+
)
955+
949956
try:
950957
from rai_s2s.asr import TRANSCRIBE_MODELS
951958

952959
step_names.append("🎙️ Speech Recognition")
953960
step_render.append(asr)
954-
except ImportError:
961+
except ImportError as e:
955962
st.session_state.features["s2s"] = False
956-
logging.warning(
957-
"skipping speech recognition, missing import - install `poetry install --with s2s`"
958-
)
963+
logging.warning(f"Skipping speech recognition. {e}")
959964

960965
try:
961966
from rai_s2s.tts import TTS_MODELS
962967

963968
step_names.append("🔊 Text to Speech")
964969
step_render.append(tts)
965-
except ImportError:
970+
except ImportError as e:
966971
st.session_state.features["s2s"] = False
967-
logging.warning(
968-
"skipping text to speech, missing import - install `poetry install --with s2s`"
969-
)
972+
logging.warning(f"Skipping text to speech. {e}")
970973

971974
step_names.extend(
972975
[

0 commit comments

Comments
 (0)