Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Dockerfile +4 -4
- entrypoint.sh +4 -4
- opencode.json +13 -16
Dockerfile
CHANGED
|
@@ -2,9 +2,9 @@
|
|
| 2 |
# - Listens on port 7860 (HF Spaces default, set in README.md app_port)
|
| 3 |
# - HF Spaces enforces UID 1000 at runtime
|
| 4 |
# - All state stored at /data/paperclip (HF Storage Bucket mount)
|
| 5 |
-
# - Uses opencode_local adapter β
|
| 6 |
-
# Β·
|
| 7 |
-
# Β·
|
| 8 |
#
|
| 9 |
# Fix: original docker-entrypoint.sh calls `gosu` to drop rootβnode, which
|
| 10 |
# fails on HF Spaces (already UID 1000, not root). We use our own entrypoint
|
|
@@ -31,7 +31,7 @@ USER node
|
|
| 31 |
# PORT=7860 β HF Spaces default port
|
| 32 |
#
|
| 33 |
# Set these in HF Space Secrets (Settings β Variables and Secrets):
|
| 34 |
-
#
|
| 35 |
# BETTER_AUTH_SECRET β any long random string
|
| 36 |
# PAPERCLIP_PUBLIC_URL β https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
|
| 37 |
# PAPERCLIP_ALLOWED_HOSTNAMES β YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
|
|
|
|
| 2 |
# - Listens on port 7860 (HF Spaces default, set in README.md app_port)
|
| 3 |
# - HF Spaces enforces UID 1000 at runtime
|
| 4 |
# - All state stored at /data/paperclip (HF Storage Bucket mount)
|
| 5 |
+
# - Uses opencode_local adapter β Z.AI Coding Plan API
|
| 6 |
+
# Β· glm-5.2 β primary model (complex tasks)
|
| 7 |
+
# Β· glm-4.7 β small/fast model (titles, summaries, compaction)
|
| 8 |
#
|
| 9 |
# Fix: original docker-entrypoint.sh calls `gosu` to drop rootβnode, which
|
| 10 |
# fails on HF Spaces (already UID 1000, not root). We use our own entrypoint
|
|
|
|
| 31 |
# PORT=7860 β HF Spaces default port
|
| 32 |
#
|
| 33 |
# Set these in HF Space Secrets (Settings β Variables and Secrets):
|
| 34 |
+
# ZAI_API_KEY β your Z.AI Coding Plan API key
|
| 35 |
# BETTER_AUTH_SECRET β any long random string
|
| 36 |
# PAPERCLIP_PUBLIC_URL β https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
|
| 37 |
# PAPERCLIP_ALLOWED_HOSTNAMES β YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
|
entrypoint.sh
CHANGED
|
@@ -47,15 +47,15 @@ cp /app/opencode.json "${OPENCODE_CONFIG_DIR}/config.json"
|
|
| 47 |
mkdir -p "${OPENCODE_STATE_DIR}"
|
| 48 |
cat > "${OPENCODE_STATE_DIR}/auth.json" <<AUTHEOF
|
| 49 |
{
|
| 50 |
-
"
|
| 51 |
"type": "api",
|
| 52 |
-
"key": "${
|
| 53 |
}
|
| 54 |
}
|
| 55 |
AUTHEOF
|
| 56 |
|
| 57 |
-
echo "[entrypoint] OpenCode configured β
|
| 58 |
-
echo "[entrypoint] Models:
|
| 59 |
echo "[entrypoint] Starting Paperclip..."
|
| 60 |
|
| 61 |
# ββ 4. Start the server βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
|
|
| 47 |
mkdir -p "${OPENCODE_STATE_DIR}"
|
| 48 |
cat > "${OPENCODE_STATE_DIR}/auth.json" <<AUTHEOF
|
| 49 |
{
|
| 50 |
+
"zai-coding-plan": {
|
| 51 |
"type": "api",
|
| 52 |
+
"key": "${ZAI_API_KEY}"
|
| 53 |
}
|
| 54 |
}
|
| 55 |
AUTHEOF
|
| 56 |
|
| 57 |
+
echo "[entrypoint] OpenCode configured β Z.AI Coding Plan (https://api.z.ai/api/coding/paas/v4)"
|
| 58 |
+
echo "[entrypoint] Models: glm-5.2 (primary) | glm-4.7 (small/fast)"
|
| 59 |
echo "[entrypoint] Starting Paperclip..."
|
| 60 |
|
| 61 |
# ββ 4. Start the server βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
opencode.json
CHANGED
|
@@ -1,30 +1,27 @@
|
|
| 1 |
{
|
| 2 |
"$schema": "https://opencode.ai/config.json",
|
| 3 |
"provider": {
|
| 4 |
-
"
|
| 5 |
"npm": "@ai-sdk/openai-compatible",
|
| 6 |
-
"name": "
|
| 7 |
"options": {
|
| 8 |
-
"baseURL": "https://
|
| 9 |
},
|
| 10 |
"models": {
|
| 11 |
-
"
|
| 12 |
-
"name": "
|
| 13 |
},
|
| 14 |
-
"
|
| 15 |
-
"name": "
|
| 16 |
-
},
|
| 17 |
-
"qwen3-30b-a3b": {
|
| 18 |
-
"name": "Qwen3 30B"
|
| 19 |
}
|
| 20 |
}
|
| 21 |
}
|
| 22 |
},
|
| 23 |
-
"model": "
|
| 24 |
-
"small_model": "
|
| 25 |
"agent": {
|
| 26 |
-
"title": { "model": "
|
| 27 |
-
"summary": { "model": "
|
| 28 |
-
"compaction": { "model": "
|
| 29 |
}
|
| 30 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
"$schema": "https://opencode.ai/config.json",
|
| 3 |
"provider": {
|
| 4 |
+
"zai-coding-plan": {
|
| 5 |
"npm": "@ai-sdk/openai-compatible",
|
| 6 |
+
"name": "Z.AI Coding Plan",
|
| 7 |
"options": {
|
| 8 |
+
"baseURL": "https://api.z.ai/api/coding/paas/v4"
|
| 9 |
},
|
| 10 |
"models": {
|
| 11 |
+
"glm-5.2": {
|
| 12 |
+
"name": "GLM-5.2"
|
| 13 |
},
|
| 14 |
+
"glm-4.7": {
|
| 15 |
+
"name": "GLM-4.7"
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
}
|
| 18 |
}
|
| 19 |
},
|
| 20 |
+
"model": "zai-coding-plan/glm-5.2",
|
| 21 |
+
"small_model": "zai-coding-plan/glm-4.7",
|
| 22 |
"agent": {
|
| 23 |
+
"title": { "model": "zai-coding-plan/glm-4.7" },
|
| 24 |
+
"summary": { "model": "zai-coding-plan/glm-4.7" },
|
| 25 |
+
"compaction": { "model": "zai-coding-plan/glm-4.7" }
|
| 26 |
}
|
| 27 |
+
}
|