mooncak397 Claude Opus 5.5 commited on
Commit Β·
e907066
1
Parent(s): fd995a1
docs: DEPLOY.md (Resend, Turnstile, HF Space, Pages); README front matter for the Space
Browse files- README.md +9 -1
- docs/DEPLOY.md +58 -0
README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Recruiter assistant
|
| 2 |
|
| 3 |
A chat assistant that answers recruiters' questions about Christopher, grounded in his public profile, in English or German. Work in progress: only the local command-line chat exists so far.
|
|
@@ -19,7 +27,7 @@ Every prompt version will be scored against a fixed golden set, and the score hi
|
|
| 19 |
- `POST /contact` with the token and `{"email", "message", "turnstile_token"}` sends one email through Resend; 503 when `RESEND_API_KEY` or `CONTACT_TO` is missing.
|
| 20 |
- `GET /health` returns the prompt version.
|
| 21 |
|
| 22 |
-
Env names are in `.env.example`. The `Dockerfile` is for a Hugging Face Docker Space (port 7860).
|
| 23 |
|
| 24 |
## Tests
|
| 25 |
|
|
|
|
| 1 |
+
---
|
| 2 |
+
# Hugging Face Space config (docs/DEPLOY.md). GitHub shows this block as a table.
|
| 3 |
+
title: Recruiter assistant
|
| 4 |
+
sdk: docker
|
| 5 |
+
app_port: 7860
|
| 6 |
+
pinned: false
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
# Recruiter assistant
|
| 10 |
|
| 11 |
A chat assistant that answers recruiters' questions about Christopher, grounded in his public profile, in English or German. Work in progress: only the local command-line chat exists so far.
|
|
|
|
| 27 |
- `POST /contact` with the token and `{"email", "message", "turnstile_token"}` sends one email through Resend; 503 when `RESEND_API_KEY` or `CONTACT_TO` is missing.
|
| 28 |
- `GET /health` returns the prompt version.
|
| 29 |
|
| 30 |
+
Env names are in `.env.example`. The `Dockerfile` is for a Hugging Face Docker Space (port 7860). Deploy steps: `docs/DEPLOY.md`.
|
| 31 |
|
| 32 |
## Tests
|
| 33 |
|
docs/DEPLOY.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Deploy
|
| 2 |
+
|
| 3 |
+
The backend runs as a Hugging Face Docker Space, the chat page runs on GitHub Pages. Do the steps in this order: the Space URL goes into the page config, and the page origin goes into the Space settings.
|
| 4 |
+
|
| 5 |
+
Replace `<hf-user>` with your Hugging Face user name. The Space URL is `https://<hf-user>-recruiter-assistant.hf.space` (lowercase; dots and underscores in the name become dashes). The page URL is `https://mooncak397.github.io/recruiter-assistant/`.
|
| 6 |
+
|
| 7 |
+
## 1. Resend (contact form email)
|
| 8 |
+
|
| 9 |
+
1. Create an account at https://resend.com.
|
| 10 |
+
2. Go to **API Keys**, create a key with "Sending access". Copy it for step 3.
|
| 11 |
+
3. Without a verified domain, Resend only sends from `onboarding@resend.dev` and only to the email address of your Resend account. Use that address as `CONTACT_TO`. With your own domain verified, you can also set `CONTACT_FROM`, for example `Recruiter assistant <bot@your-domain>`.
|
| 12 |
+
|
| 13 |
+
## 2. Cloudflare Turnstile (bot check)
|
| 14 |
+
|
| 15 |
+
1. Create a free Cloudflare account, open **Turnstile**, click **Add widget**.
|
| 16 |
+
2. Hostnames: `mooncak397.github.io` (add `localhost` too if you want to test locally). Mode: **Managed**.
|
| 17 |
+
3. Copy the **site key** into `web/config.js` as `TURNSTILE_SITE_KEY`. It is public.
|
| 18 |
+
4. Keep the **secret key** for step 3. It is a secret: never put it in the repo.
|
| 19 |
+
|
| 20 |
+
## 3. Hugging Face Space (backend)
|
| 21 |
+
|
| 22 |
+
1. Create an account at https://huggingface.co and go to **New Space**.
|
| 23 |
+
2. Name: `recruiter-assistant`. SDK: **Docker**, template **Blank**. Hardware: **CPU basic (free)**. Visibility: public is fine, the code is public on GitHub anyway.
|
| 24 |
+
3. In the Space, open **Settings β Variables and secrets**. Add these as **secrets**:
|
| 25 |
+
- `ANTHROPIC_API_KEY` (Claude), or `GEMINI_API_KEY` (Gemini free tier). One is enough.
|
| 26 |
+
- `SESSION_HMAC_KEY`: a random value. Make one with `python3 -c "import secrets; print(secrets.token_hex(32))"`.
|
| 27 |
+
- `RESEND_API_KEY`: from step 1.
|
| 28 |
+
- `TURNSTILE_SECRET`: from step 2.
|
| 29 |
+
- `CONTACT_TO`: the email address that gets the contact messages (see step 1.3).
|
| 30 |
+
4. Add these as **variables** (not secret):
|
| 31 |
+
- Claude: `PROVIDER_APP=anthropic` and `MODEL_APP=claude-haiku-5-5`.
|
| 32 |
+
- Gemini: `MODEL_APP=gemini-3.5-flash-lite` (the provider default is Gemini, so no `PROVIDER_APP`).
|
| 33 |
+
- `ALLOWED_ORIGIN=https://mooncak397.github.io` (the origin only: no path, no trailing slash).
|
| 34 |
+
5. Create a Hugging Face access token with **write** permission: **Settings β Access Tokens**.
|
| 35 |
+
6. Push the repo to the Space, from the repo folder:
|
| 36 |
+
```sh
|
| 37 |
+
git remote add space https://huggingface.co/spaces/<hf-user>/recruiter-assistant
|
| 38 |
+
git push --force space main
|
| 39 |
+
```
|
| 40 |
+
Git asks for a user name (your HF user name) and a password (the write token from step 5). `--force` is only for this first push: it replaces the starter README that the new Space has. Later pushes are a normal `git push space main`. The front matter at the top of `README.md` tells the Space to build the `Dockerfile` on port 7860.
|
| 41 |
+
7. Wait for the build (Space page, **Logs** tab, a few minutes). Then check:
|
| 42 |
+
```sh
|
| 43 |
+
curl https://<hf-user>-recruiter-assistant.hf.space/health
|
| 44 |
+
```
|
| 45 |
+
The reply is `{"status":"ok","prompt_version":"..."}`.
|
| 46 |
+
|
| 47 |
+
A free Space sleeps after 48 hours without traffic. The page calls `/health` on load to wake it; the first answer then takes about a minute.
|
| 48 |
+
|
| 49 |
+
## 4. GitHub Pages (chat page)
|
| 50 |
+
|
| 51 |
+
1. In `web/config.js`, set `API_BASE` to `https://<hf-user>-recruiter-assistant.hf.space` (no trailing slash). The `TURNSTILE_SITE_KEY` is set from step 2.3.
|
| 52 |
+
2. On GitHub, open the repo **Settings β Pages**. Under **Build and deployment β Source**, choose **GitHub Actions**.
|
| 53 |
+
3. Commit and push the `web/config.js` change to `main`. A push that changes `web/` starts the **Pages** workflow. You can also start it by hand: **Actions β Pages β Run workflow**.
|
| 54 |
+
4. Open `https://mooncak397.github.io/recruiter-assistant/`. Ask one question and send one test message with the contact form.
|
| 55 |
+
|
| 56 |
+
## Optional: evals in CI
|
| 57 |
+
|
| 58 |
+
The **CI** workflow runs the tests on every push. Its `evals-fast` job runs only by hand (**Actions β CI β Run workflow**) and needs a repository secret: **Settings β Secrets and variables β Actions β New repository secret**, name `ANTHROPIC_API_KEY` or `GEMINI_API_KEY`. Each run calls the model for every golden case, so it costs money with Claude (a few cents).
|