Spaces:
Running
Running
Update config_provider.py
Browse files- config_provider.py +20 -1
config_provider.py
CHANGED
@@ -16,7 +16,12 @@ class GlobalConfig(BaseModel):
|
|
16 |
work_mode: str = Field("hfcloud", pattern=r"^(hfcloud|cloud|on-premise|gpt4o|gpt4o-mini)$")
|
17 |
cloud_token: Optional[str] = None
|
18 |
spark_endpoint: HttpUrl
|
19 |
-
internal_prompt: Optional[str] = None
|
|
|
|
|
|
|
|
|
|
|
20 |
users: List["UserConfig"] = []
|
21 |
|
22 |
def is_gpt_mode(self) -> bool:
|
@@ -38,6 +43,20 @@ class GlobalConfig(BaseModel):
|
|
38 |
return decrypt(self.cloud_token)
|
39 |
return None
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
def is_cloud_mode(self) -> bool:
|
42 |
"""Check if running in cloud mode (hfcloud or cloud)"""
|
43 |
return self.work_mode in ("hfcloud", "cloud")
|
|
|
16 |
work_mode: str = Field("hfcloud", pattern=r"^(hfcloud|cloud|on-premise|gpt4o|gpt4o-mini)$")
|
17 |
cloud_token: Optional[str] = None
|
18 |
spark_endpoint: HttpUrl
|
19 |
+
internal_prompt: Optional[str] = None
|
20 |
+
# TTS/STT configurations
|
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|elevenlabs|flicker)$")
|
24 |
+
stt_engine_api_key: Optional[str] = None
|
25 |
users: List["UserConfig"] = []
|
26 |
|
27 |
def is_gpt_mode(self) -> bool:
|
|
|
43 |
return decrypt(self.cloud_token)
|
44 |
return None
|
45 |
|
46 |
+
def get_tts_api_key(self) -> Optional[str]:
|
47 |
+
"""Get decrypted TTS API key"""
|
48 |
+
if self.tts_engine_api_key and self.tts_engine_api_key.startswith("enc:"):
|
49 |
+
from encryption_utils import decrypt
|
50 |
+
return decrypt(self.tts_engine_api_key)
|
51 |
+
return self.tts_engine_api_key
|
52 |
+
|
53 |
+
def get_stt_api_key(self) -> Optional[str]:
|
54 |
+
"""Get decrypted STT API key"""
|
55 |
+
if self.stt_engine_api_key and self.stt_engine_api_key.startswith("enc:"):
|
56 |
+
from encryption_utils import decrypt
|
57 |
+
return decrypt(self.stt_engine_api_key)
|
58 |
+
return self.stt_engine_api_key
|
59 |
+
|
60 |
def is_cloud_mode(self) -> bool:
|
61 |
"""Check if running in cloud mode (hfcloud or cloud)"""
|
62 |
return self.work_mode in ("hfcloud", "cloud")
|