Spaces:
Building
Building
Update stt_factory.py
Browse files- stt_factory.py +6 -5
stt_factory.py
CHANGED
@@ -59,7 +59,8 @@ class STTFactory:
|
|
59 |
"""Create STT provider based on configuration"""
|
60 |
try:
|
61 |
cfg = ConfigProvider.get()
|
62 |
-
|
|
|
63 |
|
64 |
log_info(f"🎤 Creating STT provider: {stt_engine}")
|
65 |
|
@@ -69,14 +70,14 @@ class STTFactory:
|
|
69 |
# Get provider class
|
70 |
provider_class = stt_providers.get(stt_engine)
|
71 |
if not provider_class:
|
72 |
-
|
73 |
return NoSTT()
|
74 |
|
75 |
# Get API key or credentials
|
76 |
-
api_key =
|
77 |
|
78 |
if not api_key:
|
79 |
-
|
80 |
return NoSTT()
|
81 |
|
82 |
# Create provider instance
|
@@ -87,7 +88,7 @@ class STTFactory:
|
|
87 |
# For Azure, parse the key format
|
88 |
parts = api_key.split('|')
|
89 |
if len(parts) != 2:
|
90 |
-
|
91 |
return NoSTT()
|
92 |
return provider_class(subscription_key=parts[0], region=parts[1])
|
93 |
elif stt_engine == "flicker":
|
|
|
59 |
"""Create STT provider based on configuration"""
|
60 |
try:
|
61 |
cfg = ConfigProvider.get()
|
62 |
+
stt_provider_config = cfg.global_config.stt_provider
|
63 |
+
stt_engine = stt_provider_config.name
|
64 |
|
65 |
log_info(f"🎤 Creating STT provider: {stt_engine}")
|
66 |
|
|
|
70 |
# Get provider class
|
71 |
provider_class = stt_providers.get(stt_engine)
|
72 |
if not provider_class:
|
73 |
+
log_warning(f"⚠️ STT provider '{stt_engine}' not available")
|
74 |
return NoSTT()
|
75 |
|
76 |
# Get API key or credentials
|
77 |
+
api_key = stt_provider_config.api_key
|
78 |
|
79 |
if not api_key:
|
80 |
+
log_warning(f"⚠️ No API key configured for {stt_engine}")
|
81 |
return NoSTT()
|
82 |
|
83 |
# Create provider instance
|
|
|
88 |
# For Azure, parse the key format
|
89 |
parts = api_key.split('|')
|
90 |
if len(parts) != 2:
|
91 |
+
log_warning("⚠️ Invalid Azure STT key format. Expected: subscription_key|region")
|
92 |
return NoSTT()
|
93 |
return provider_class(subscription_key=parts[0], region=parts[1])
|
94 |
elif stt_engine == "flicker":
|