Rename OPENAI_API_KEY to HERMES_OPENAI_API_KEY in configuration and codebase for clarity and to avoid conflicts. Update related documentation and error messages to reflect the new key name, ensuring backward compatibility with existing setups.
This commit is contained in:
@@ -47,12 +47,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
|
||||
"""
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
# Use HERMES_OPENAI_API_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")
|
||||
if not api_key:
|
||||
return {
|
||||
"success": False,
|
||||
"transcript": "",
|
||||
"error": "OPENAI_API_KEY not set",
|
||||
"error": "HERMES_OPENAI_API_KEY not set",
|
||||
}
|
||||
|
||||
audio_path = Path(file_path)
|
||||
@@ -100,4 +103,4 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> dict:
|
||||
|
||||
def check_stt_requirements() -> bool:
|
||||
"""Check if OpenAI API key is available for speech-to-text."""
|
||||
return bool(os.getenv("OPENAI_API_KEY"))
|
||||
return bool(os.getenv("HERMES_OPENAI_API_KEY") or os.getenv("OPENAI_API_KEY"))
|
||||
|
||||
Reference in New Issue
Block a user