Upload 9 files
Browse files- .env.example +7 -3
- README.md +8 -3
.env.example
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
-
ENVIRONMENT=
|
| 2 |
ORIGIN_TOKEN=replace-with-the-same-random-value-as-worker-HF_ORIGIN_TOKEN
|
| 3 |
OPENAI_API_KEY=
|
| 4 |
ANTHROPIC_API_KEY=
|
| 5 |
PRIMO_API_KEY=
|
| 6 |
ADMIN_PASSWORD=replace-with-a-strong-admin-password
|
| 7 |
-
CLOUDFLARE_WORKER_URL=https://
|
| 8 |
CLOUDFLARE_ADMIN_TOKEN=replace-with-the-same-random-value-as-worker-ADMIN_TOKEN
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
CONTACT_EMAIL=libse@ku.ac.ae
|
| 10 |
RUNTIME_DIR=./libbee_runtime
|
| 11 |
-
ALLOWED_CORS_ORIGINS=
|
|
|
|
| 1 |
+
ENVIRONMENT=production
|
| 2 |
ORIGIN_TOKEN=replace-with-the-same-random-value-as-worker-HF_ORIGIN_TOKEN
|
| 3 |
OPENAI_API_KEY=
|
| 4 |
ANTHROPIC_API_KEY=
|
| 5 |
PRIMO_API_KEY=
|
| 6 |
ADMIN_PASSWORD=replace-with-a-strong-admin-password
|
| 7 |
+
CLOUDFLARE_WORKER_URL=https://steep-haze-e1f8.nikeshn.workers.dev
|
| 8 |
CLOUDFLARE_ADMIN_TOKEN=replace-with-the-same-random-value-as-worker-ADMIN_TOKEN
|
| 9 |
+
LIBCAL_CLIENT_ID=
|
| 10 |
+
LIBCAL_CLIENT_SECRET=
|
| 11 |
+
LIBCAL_EVENTS_CLIENT_ID=
|
| 12 |
+
LIBCAL_EVENTS_CLIENT_SECRET=
|
| 13 |
CONTACT_EMAIL=libse@ku.ac.ae
|
| 14 |
RUNTIME_DIR=./libbee_runtime
|
| 15 |
+
ALLOWED_CORS_ORIGINS=
|
README.md
CHANGED
|
@@ -8,7 +8,7 @@ app_file: app.py
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
-
# LibBee private origin v4.
|
| 12 |
|
| 13 |
This Hugging Face Space is the private application origin behind the Cloudflare Worker. Browsers must not call `/agent`, `/search`, or `/feedback` directly. Those routes require `X-LibBee-Origin-Token`, which the Worker adds server-side.
|
| 14 |
|
|
@@ -17,8 +17,11 @@ This Hugging Face Space is the private application origin behind the Cloudflare
|
|
| 17 |
- `ORIGIN_TOKEN`: a new random secret; must match the Worker's `HF_ORIGIN_TOKEN`.
|
| 18 |
- `OPENAI_API_KEY`: required for the default model, classification, embeddings, and RAG.
|
| 19 |
- `ADMIN_PASSWORD`: strong password for `/admin`.
|
| 20 |
-
- `CLOUDFLARE_WORKER_URL`:
|
| 21 |
-
- `CLOUDFLARE_ADMIN_TOKEN`: must match the Worker's `ADMIN_TOKEN`;
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
Optional secrets: `ANTHROPIC_API_KEY` and `PRIMO_API_KEY`.
|
| 24 |
|
|
@@ -32,6 +35,8 @@ Use persistent HF storage and keep `RUNTIME_DIR=/data/libbee_runtime` so runtime
|
|
| 32 |
- The signed FAISS/BM25 cache is ignored if it was modified or if no origin secret is configured.
|
| 33 |
- Raw scrape dumps are kept in `data/knowledge_raw_archive` but excluded from indexing. Curated, review-dated files are indexed.
|
| 34 |
- Persistent analytics is written by the Worker, not by the browser or the HF origin.
|
|
|
|
|
|
|
| 35 |
|
| 36 |
## Local checks
|
| 37 |
|
|
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# LibBee private origin v4.1 — no custom domain
|
| 12 |
|
| 13 |
This Hugging Face Space is the private application origin behind the Cloudflare Worker. Browsers must not call `/agent`, `/search`, or `/feedback` directly. Those routes require `X-LibBee-Origin-Token`, which the Worker adds server-side.
|
| 14 |
|
|
|
|
| 17 |
- `ORIGIN_TOKEN`: a new random secret; must match the Worker's `HF_ORIGIN_TOKEN`.
|
| 18 |
- `OPENAI_API_KEY`: required for the default model, classification, embeddings, and RAG.
|
| 19 |
- `ADMIN_PASSWORD`: strong password for `/admin`.
|
| 20 |
+
- `CLOUDFLARE_WORKER_URL`: `https://steep-haze-e1f8.nikeshn.workers.dev`; returned only to an authenticated admin browser with a short-lived token.
|
| 21 |
+
- `CLOUDFLARE_ADMIN_TOKEN`: must match the Worker's `ADMIN_TOKEN`; used to sign 90-second read-only browser tokens. The permanent value is never returned to JavaScript.
|
| 22 |
+
- `LIBCAL_CLIENT_ID` and `LIBCAL_CLIENT_SECRET`: used by HF to fetch live hours directly.
|
| 23 |
+
|
| 24 |
+
If events use separate credentials, also set `LIBCAL_EVENTS_CLIENT_ID` and `LIBCAL_EVENTS_CLIENT_SECRET`; otherwise the main LibCal credentials are reused.
|
| 25 |
|
| 26 |
Optional secrets: `ANTHROPIC_API_KEY` and `PRIMO_API_KEY`.
|
| 27 |
|
|
|
|
| 35 |
- The signed FAISS/BM25 cache is ignored if it was modified or if no origin secret is configured.
|
| 36 |
- Raw scrape dumps are kept in `data/knowledge_raw_archive` but excluded from indexing. Curated, review-dated files are indexed.
|
| 37 |
- Persistent analytics is written by the Worker, not by the browser or the HF origin.
|
| 38 |
+
- A logged-in admin browser receives only an HMAC-signed `analytics:read` token that expires after 90 seconds; Worker write endpoints reject it.
|
| 39 |
+
- Live LibCal requests originate from HF, avoiding the unavailable HF-to-`workers.dev` loop.
|
| 40 |
|
| 41 |
## Local checks
|
| 42 |
|