alexrs commited on
Commit
8a883b3
·
verified ·
1 Parent(s): 4299951

Require Hugging Face sign-in to chat

Browse files

Enable hf_oauth and map the injected OAUTH_CLIENT_ID/SECRET to chat-ui's OPENID_CLIENT_ID/SECRET. Together with MESSAGES_BEFORE_LOGIN=0 this rejects anonymous POSTs (scripted gpt4free traffic). Per-user rate limit via USAGE_LIMITS.

Files changed (2) hide show
  1. Dockerfile +3 -1
  2. README.md +1 -0
Dockerfile CHANGED
@@ -1 +1,3 @@
1
- FROM ghcr.io/huggingface/chat-ui-db:sha-c6f34ec
 
 
 
1
+ FROM ghcr.io/huggingface/chat-ui-db:sha-c6f34ec
2
+ # hf_oauth injects OAUTH_CLIENT_ID/OAUTH_CLIENT_SECRET; chat-ui reads OPENID_CLIENT_ID/OPENID_CLIENT_SECRET
3
+ CMD ["/bin/bash", "-c", "export OPENID_CLIENT_ID=\"$OAUTH_CLIENT_ID\" OPENID_CLIENT_SECRET=\"$OAUTH_CLIENT_SECRET\"; exec /app/entrypoint.sh"]
README.md CHANGED
@@ -7,6 +7,7 @@ sdk: docker
7
  pinned: false
8
  license: other
9
  app_port: 3000
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
7
  pinned: false
8
  license: other
9
  app_port: 3000
10
+ hf_oauth: true
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference