refactor: rename HERMES_OPENAI_API_KEY to VOICE_TOOLS_OPENAI_KEY
- Updated the environment variable name from HERMES_OPENAI_API_KEY to VOICE_TOOLS_OPENAI_KEY across multiple files to avoid interference with OpenRouter. - Adjusted related error messages and configuration prompts to reflect the new variable name, ensuring consistency throughout the codebase.
This commit is contained in:
parent
4d1f2ea522
commit
0858ee2f27
6 changed files with 18 additions and 18 deletions
|
|
@ -50,15 +50,15 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
|
|||
- "transcript" (str): The transcribed text (empty on failure)
|
||||
- "error" (str, optional): Error message if success is False
|
||||
"""
|
||||
# Use HERMES_OPENAI_API_KEY to avoid interference with the OpenAI SDK's
|
||||
# Use VOICE_TOOLS_OPENAI_KEY to avoid interference with the OpenAI SDK's
|
||||
# auto-detection of OPENAI_API_KEY (which would break OpenRouter calls).
|
||||
# Falls back to OPENAI_API_KEY for backward compatibility.
|
||||
api_key = os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")
|
||||
api_key = os.getenv("VOICE_TOOLS_OPENAI_KEY") or os.getenv("OPENAI_API_KEY")
|
||||
if not api_key:
|
||||
return {
|
||||
"success": False,
|
||||
"transcript": "",
|
||||
"error": "HERMES_OPENAI_API_KEY not set",
|
||||
"error": "VOICE_TOOLS_OPENAI_KEY not set",
|
||||
}
|
||||
|
||||
audio_path = Path(file_path)
|
||||
|
|
|
|||
|
|
@ -210,9 +210,9 @@ def _generate_openai_tts(text: str, output_path: str, tts_config: Dict[str, Any]
|
|||
Returns:
|
||||
Path to the saved audio file.
|
||||
"""
|
||||
api_key = os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY", "")
|
||||
api_key = os.getenv("VOICE_TOOLS_OPENAI_KEY") or os.getenv("OPENAI_API_KEY", "")
|
||||
if not api_key:
|
||||
raise ValueError("HERMES_OPENAI_API_KEY not set. Get one at https://platform.openai.com/api-keys")
|
||||
raise ValueError("VOICE_TOOLS_OPENAI_KEY not set. Get one at https://platform.openai.com/api-keys")
|
||||
|
||||
oai_config = tts_config.get("openai", {})
|
||||
model = oai_config.get("model", DEFAULT_OPENAI_MODEL)
|
||||
|
|
@ -392,7 +392,7 @@ def check_tts_requirements() -> bool:
|
|||
return True
|
||||
if _HAS_ELEVENLABS and os.getenv("ELEVENLABS_API_KEY"):
|
||||
return True
|
||||
if _HAS_OPENAI and (os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY")):
|
||||
if _HAS_OPENAI and (os.getenv("VOICE_TOOLS_OPENAI_KEY") or os.getenv("OPENAI_API_KEY")):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ if __name__ == "__main__":
|
|||
print(f" ElevenLabs: {'✅ installed' if _HAS_ELEVENLABS else '❌ not installed (pip install elevenlabs)'}")
|
||||
print(f" API Key: {'✅ set' if os.getenv('ELEVENLABS_API_KEY') else '❌ not set'}")
|
||||
print(f" OpenAI: {'✅ installed' if _HAS_OPENAI else '❌ not installed'}")
|
||||
print(f" API Key: {'✅ set' if (os.getenv('HERMES_OPENAI_API_KEY') or os.getenv('OPENAI_API_KEY')) else '❌ not set'}")
|
||||
print(f" API Key: {'✅ set' if (os.getenv('VOICE_TOOLS_OPENAI_KEY') or os.getenv('OPENAI_API_KEY')) else '❌ not set'}")
|
||||
print(f" ffmpeg: {'✅ found' if _has_ffmpeg() else '❌ not found (needed for Telegram Opus)'}")
|
||||
print(f"\n Output dir: {DEFAULT_OUTPUT_DIR}")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue