ml-intern
ml-intern copied to clipboard
Issue #23 Fix: Use logged in hf token using `huggingface_hub.get_token()` instead of requiring env variable
Summary
- Add a shared Hugging Face token helper that keeps
HF_TOKENas the first local token source and falls back tohuggingface_hub.get_token() - Reuse the helper in CLI and backend session creation so users logged in with
huggingface-cli logindo not need to setHF_TOKEN - Update the README quick start notes to document the login-cache fallback while keeping the existing environment variable flow
Test plan
- [x] Run
python -m py_compile agent\utils\hf_auth.py agent\main.py backend\routes\agent.py - [x] Verify
HF_TOKENtakes precedence overhuggingface_hub.get_token() - [x] Confirm README changes are limited to the HF token setup note
Fixes #23
conflict resolved
@claude please review this PR. Focus on correctness, security, LiteLLM/Bedrock routing impact, and whether it's safe to merge against current main. Keep it concise and prefer inline comments where it matters.