Skip to content

fix: configurator bugs fixes #640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/rai_core/rai/frontend/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from langchain_ollama import ChatOllama, OllamaEmbeddings
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
import logging
import importlib.util


def get_sound_devices(
Expand Down Expand Up @@ -831,7 +832,7 @@ def test_langsmith():

def test_tts():
vendor = st.session_state.config["tts"]["vendor"]
if vendor == "elevenlabs":
if vendor == "ElevenLabs":
try:
from elevenlabs import ElevenLabs

Expand All @@ -842,7 +843,7 @@ def test_tts():
except Exception as e:
st.error(f"TTS error: {e}")
return False
elif vendor == "opentts":
elif vendor == "OpenTTS":
try:
params = {
"voice": "glow-speak:en-us_mary_ann",
Expand All @@ -862,7 +863,7 @@ def test_recording_device(device_name: str):

devices = sd.query_devices()
index = [device["name"] for device in devices].index(device_name)
sample_rate = int(devices[device_index]["default_samplerate"])
sample_rate = int(devices[index]["default_samplerate"])
try:
recording = sd.rec(
device=index,
Expand Down Expand Up @@ -945,29 +946,30 @@ def setup_steps():
step_names = ["👋 Welcome", "🤖 Model Selection", "📊 Tracing"]
step_render = [welcome, model_selection, tracing]

st.session_state.features["s2s"] = True

if importlib.util.find_spec("rai_s2s") is None:
logging.warning(
"Skipping speech recognition, rai_s2s not installed - install `poetry install --with s2s`"
)

try:
from rai_s2s.asr import TRANSCRIBE_MODELS

step_names.append("🎙️ Speech Recognition")
step_render.append(asr)
except ImportError:
except ImportError as e:
st.session_state.features["s2s"] = False
logging.warning(
"skipping speech recognition, missing import - install `poetry install --with s2s`"
)
pass
logging.warning(f"Skipping speech recognition. {e}")

try:
from rai_s2s.tts import TTS_MODELS

step_names.append("🔊 Text to Speech")
step_render.append(tts)
except ImportError:
except ImportError as e:
st.session_state.features["s2s"] = False
logging.warning(
"skipping text to speech, missing import - install `poetry install --with s2s`"
)
pass
logging.warning(f"Skipping text to speech. {e}")

step_names.extend(
[
Expand Down