ciyidogan commited on
Commit
82b3923
·
verified ·
1 Parent(s): 857ec80

Update stt/stt_factory.py

Browse files
Files changed (1) hide show
  1. stt/stt_factory.py +14 -2
stt/stt_factory.py CHANGED
@@ -79,7 +79,7 @@ class STTFactory:
79
  return NoSTT()
80
 
81
  # Get API key or credentials
82
- api_key = stt_provider_config.api_key
83
 
84
  if not api_key:
85
  log_warning(f"⚠️ No API key configured for {stt_engine}")
@@ -110,4 +110,16 @@ class STTFactory:
110
  @staticmethod
111
  def get_available_providers():
112
  """Get list of available STT providers"""
113
- return list(stt_providers.keys()) + ["no_stt"]
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  return NoSTT()
80
 
81
  # Get API key or credentials
82
+ api_key = _get_api_key(stt_provider_config)
83
 
84
  if not api_key:
85
  log_warning(f"⚠️ No API key configured for {stt_engine}")
 
110
  @staticmethod
111
  def get_available_providers():
112
  """Get list of available STT providers"""
113
+ return list(stt_providers.keys()) + ["no_stt"]
114
+
115
+ @staticmethod
116
+ def _get_api_key(stt_config) -> Optional[str]:
117
+ """Get decrypted API key"""
118
+ if not stt_config.api_key:
119
+ return None
120
+
121
+ if stt_config.api_key.startswith("enc:"):
122
+ from utils.encryption_utils import decrypt
123
+ return decrypt(stt_config.api_key)
124
+
125
+ return stt_config.api_key