File size: 5,080 Bytes
d63dcfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6678ab
 
 
6b6afea
 
 
 
 
 
 
d63dcfe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b6afea
 
 
 
 
 
 
 
d63dcfe
 
 
 
 
6b6afea
 
 
 
 
 
 
3afbbdf
 
 
 
 
 
 
d63dcfe
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# =============================================================================
# Research Article Template Editor - Backend environment variables
# =============================================================================
# Copy this file to backend/.env and fill in the values you need.
# All variables are optional unless stated otherwise.
# See docs/SPECIFICATION.md §6.3 for the full reference.

# -----------------------------------------------------------------------------
# Server
# -----------------------------------------------------------------------------

# HTTP listen port. Defaults to 8080.
# PORT=8080

# Where documents, uploads and published bundles are stored on disk.
# Defaults to ./data (relative to the backend cwd).
# DATA_DIR=./data

# Toggle Playwright-based PDF + thumbnail generation. Set to "false" to disable
# PDF export (useful in environments without a browser).
# ENABLE_PDF=true

# -----------------------------------------------------------------------------
# Hugging Face OAuth (login + write-access check)
# -----------------------------------------------------------------------------
# Required to enforce auth on the editor. When OAUTH_CLIENT_ID and
# OAUTH_CLIENT_SECRET are unset, OAuth is disabled and every visitor can edit
# (useful for local dev).
#
# Create an OAuth app at https://huggingface.co/settings/connected-applications
# and set the redirect URI to:
#   - http://localhost:8080/auth/callback   (local dev)
#   - https://<SPACE_HOST>/auth/callback    (HF Space)

OAUTH_CLIENT_ID=
OAUTH_CLIENT_SECRET=

# Space-scoped OAuth needs:
#   - "manage-repos"  to read/write the dataset that backs persistence
#   - "inference-api" so the user's OAuth token can call HF Inference
#                     Providers (powers the chat panel + embed studio)
# Defaults to "openid profile" when unset, which is enough for login-only
# flows but disables AI features and dataset persistence.
# OAUTH_SCOPES=openid profile manage-repos inference-api

# -----------------------------------------------------------------------------
# HF Space context (auto-injected by HF Spaces, set manually for local dev)
# -----------------------------------------------------------------------------

# Identifies the Space (e.g. "tfrere/research-article-template-editor").
# Auto-set by HF Spaces. Drives the default dataset id and enables OAuth +
# secure cookies in production. Leave empty for local dev.
# SPACE_ID=

# HTTPS host of the deployed Space (e.g. "tfrere-research-article-template-editor.hf.space").
# Auto-set by HF Spaces. Used to build the OAuth redirect URI.
# SPACE_HOST=

# -----------------------------------------------------------------------------
# Hugging Face dataset persistence
# -----------------------------------------------------------------------------
# Documents (.yjs), uploads and published bundles are pushed to a HF dataset so
# they survive Space restarts.

# Override the dataset id. Defaults to "${SPACE_ID}-data" when SPACE_ID is set.
# Example: HF_DATASET_ID=tfrere/research-article-template-editor-data
# HF_DATASET_ID=

# Server-side fallback HF token. Used when no user OAuth token is present yet
# (e.g. before the first login, or during local dev without OAuth).
#
# The chat panel and embed studio call Hugging Face Inference Providers
# (https://router.huggingface.co/v1) with this token when no OAuth token is
# available. Generate one at https://huggingface.co/settings/tokens with
# "Write" scope (or a fine-grained token with both repo + inference
# permissions). Optional on a HF Space with OAuth configured - the logged-in
# user's token is used instead.
# HF_TOKEN=

# -----------------------------------------------------------------------------
# AI features (chat panel + embed studio)
# -----------------------------------------------------------------------------
# The AI assistant calls Hugging Face Inference Providers with either the
# logged-in user's OAuth token or HF_TOKEN above. No extra API key needed -
# this is the whole point of moving off OpenRouter.

# Override the default model id used by the chat agent. The list of
# supported models is in backend/src/agent/chat.ts (AVAILABLE_MODELS), but
# any model exposed by HF Inference Providers with tool-calling support
# works. Defaults to "openai/gpt-oss-120b".
# You can also pin a specific provider by appending ":<provider>" to the
# model id, e.g. "meta-llama/Llama-3.3-70B-Instruct:together" - useful
# to avoid providers (such as Groq or Nscale) that reject the editor's
# wide tool registry with "Failed to call a function" or
# "tools parameter not supported".
# HF_INFERENCE_MODEL=openai/gpt-oss-120b

# -----------------------------------------------------------------------------
# Publishing
# -----------------------------------------------------------------------------

# Absolute base URL injected into the published HTML (canonical URL,
# OpenGraph, etc.). Defaults to http://127.0.0.1:${PORT}.
# Example: PUBLISH_BASE_URL=https://tfrere-research-article-template-editor.hf.space
# PUBLISH_BASE_URL=