fix start restart bugs

This commit is contained in:
2025-06-18 12:29:13 +02:00
parent efc3870963
commit c7926724e2
3 changed files with 38 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ if audio_mode in ["Webapp", "USB"]:
# Input device selection for USB mode
if audio_mode == "USB":
try:
resp = requests.get(f"{BACKEND_URL}/audio_inputs", timeout=1)
resp = requests.get(f"{BACKEND_URL}/audio_inputs")
if resp.status_code == 200:
input_options = [f"{d['id']}:{d['name']}" for d in resp.json().get('inputs', [])]
else:
@@ -71,6 +71,10 @@ if audio_mode in ["Webapp", "USB"]:
selected_option = st.selectbox("Input Device", input_options, index=input_options.index(default_input))
with col2:
if st.button("Refresh"):
try:
requests.post(f"{BACKEND_URL}/refresh_audio_inputs", timeout=3)
except Exception as e:
st.error(f"Failed to refresh devices: {e}")
st.rerun()
# We send only the numeric/card identifier (before :) or 'default'
input_device = selected_option.split(":", 1)[0] if ":" in selected_option else selected_option