Spaces:
Building
Building
Update config_provider.py
Browse files- config_provider.py +15 -2
config_provider.py
CHANGED
@@ -17,9 +17,15 @@ class GlobalConfig(BaseModel):
|
|
17 |
cloud_token: Optional[str] = None
|
18 |
spark_endpoint: HttpUrl
|
19 |
internal_prompt: Optional[str] = None
|
20 |
-
|
|
|
21 |
tts_engine: str = Field("no_tts", pattern=r"^(no_tts|elevenlabs|blaze)$")
|
22 |
tts_engine_api_key: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
23 |
stt_engine: str = Field("no_stt", pattern=r"^(no_stt|google|azure|amazon|gpt4o_realtime)$")
|
24 |
stt_engine_api_key: Optional[str] = None
|
25 |
stt_settings: Optional[Dict[str, Any]] = Field(default_factory=lambda: {
|
@@ -32,6 +38,7 @@ class GlobalConfig(BaseModel):
|
|
32 |
"enable_punctuation": True,
|
33 |
"interim_results": True
|
34 |
})
|
|
|
35 |
users: List["UserConfig"] = []
|
36 |
|
37 |
def is_gpt_mode(self) -> bool:
|
@@ -65,7 +72,13 @@ class GlobalConfig(BaseModel):
|
|
65 |
|
66 |
log(f"π TTS key not encrypted: {'***' + raw_key[-4:] if raw_key else 'None'}")
|
67 |
return raw_key
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
def get_stt_api_key(self) -> Optional[str]:
|
70 |
"""Get decrypted STT API key or credentials path"""
|
71 |
raw_key = self.stt_engine_api_key
|
|
|
17 |
cloud_token: Optional[str] = None
|
18 |
spark_endpoint: HttpUrl
|
19 |
internal_prompt: Optional[str] = None
|
20 |
+
|
21 |
+
# TTS configurations
|
22 |
tts_engine: str = Field("no_tts", pattern=r"^(no_tts|elevenlabs|blaze)$")
|
23 |
tts_engine_api_key: Optional[str] = None
|
24 |
+
ttsSettings: Optional[Dict[str, Any]] = Field(default_factory=lambda: {
|
25 |
+
"use_ssml": False
|
26 |
+
};
|
27 |
+
|
28 |
+
# STT configurations
|
29 |
stt_engine: str = Field("no_stt", pattern=r"^(no_stt|google|azure|amazon|gpt4o_realtime)$")
|
30 |
stt_engine_api_key: Optional[str] = None
|
31 |
stt_settings: Optional[Dict[str, Any]] = Field(default_factory=lambda: {
|
|
|
38 |
"enable_punctuation": True,
|
39 |
"interim_results": True
|
40 |
})
|
41 |
+
|
42 |
users: List["UserConfig"] = []
|
43 |
|
44 |
def is_gpt_mode(self) -> bool:
|
|
|
72 |
|
73 |
log(f"π TTS key not encrypted: {'***' + raw_key[-4:] if raw_key else 'None'}")
|
74 |
return raw_key
|
75 |
+
|
76 |
+
def get_tts_settings(self) -> Dict[str, Any]:
|
77 |
+
"""Get STT settings with defaults"""
|
78 |
+
return self.tts_settings or {
|
79 |
+
"use_ssml": False
|
80 |
+
}
|
81 |
+
|
82 |
def get_stt_api_key(self) -> Optional[str]:
|
83 |
"""Get decrypted STT API key or credentials path"""
|
84 |
raw_key = self.stt_engine_api_key
|