Files
agent/langgraph_qwen/utils.py
2025-08-30 23:29:26 +08:00

23 lines
618 B
Python

_DOTENV_LOADED = False
def ensure_env_loaded() -> None:
global _DOTENV_LOADED
if _DOTENV_LOADED:
return
try:
# Lazy import to avoid hard failure if not installed
from dotenv import load_dotenv, find_dotenv # type: ignore
path = find_dotenv(usecwd=True)
if path:
load_dotenv(dotenv_path=path, override=False)
else:
# Fall back to default discovery in CWD
load_dotenv(override=False)
except Exception:
# Silently ignore if python-dotenv is not available or errors out
pass
_DOTENV_LOADED = True