Spaces:
Running
Running
Allow startup without model secrets
Browse files
README.md
CHANGED
|
@@ -11,7 +11,7 @@ secrets:
|
|
| 11 |
- name: LLM_API_KEY
|
| 12 |
description: "Your LLM provider API key. HuggingMess maps it to the right Hermes provider env var."
|
| 13 |
- name: LLM_MODEL
|
| 14 |
-
description: "
|
| 15 |
- name: TELEGRAM_BOT_TOKEN
|
| 16 |
description: "Telegram bot token from @BotFather."
|
| 17 |
- name: TELEGRAM_ALLOWED_USERS
|
|
@@ -37,7 +37,7 @@ HuggingMess runs [Nous Research Hermes Agent](https://github.com/NousResearch/he
|
|
| 37 |
|
| 38 |
| Secret | Required | Notes |
|
| 39 |
| :--- | :--- | :--- |
|
| 40 |
-
| `LLM_MODEL` |
|
| 41 |
| `LLM_API_KEY` | Usually | Used to populate the provider-specific env var automatically |
|
| 42 |
| `TELEGRAM_BOT_TOKEN` | For Telegram | Bot token from BotFather |
|
| 43 |
| `TELEGRAM_ALLOWED_USERS` | Recommended | Comma-separated numeric Telegram user IDs |
|
|
|
|
| 11 |
- name: LLM_API_KEY
|
| 12 |
description: "Your LLM provider API key. HuggingMess maps it to the right Hermes provider env var."
|
| 13 |
- name: LLM_MODEL
|
| 14 |
+
description: "Optional model ID override, e.g. openrouter/anthropic/claude-sonnet-4 or anthropic/claude-opus-4.6."
|
| 15 |
- name: TELEGRAM_BOT_TOKEN
|
| 16 |
description: "Telegram bot token from @BotFather."
|
| 17 |
- name: TELEGRAM_ALLOWED_USERS
|
|
|
|
| 37 |
|
| 38 |
| Secret | Required | Notes |
|
| 39 |
| :--- | :--- | :--- |
|
| 40 |
+
| `LLM_MODEL` | Optional | Model override. If unset, HuggingMess leaves Hermes default/restored config alone. |
|
| 41 |
| `LLM_API_KEY` | Usually | Used to populate the provider-specific env var automatically |
|
| 42 |
| `TELEGRAM_BOT_TOKEN` | For Telegram | Bot token from BotFather |
|
| 43 |
| `TELEGRAM_ALLOWED_USERS` | Recommended | Comma-separated numeric Telegram user IDs |
|
start.sh
CHANGED
|
@@ -162,12 +162,6 @@ if [ -n "${CUSTOM_BASE_URL:-}" ]; then
|
|
| 162 |
[ -n "$LLM_API_KEY" ] && export OPENAI_API_KEY="${OPENAI_API_KEY:-$LLM_API_KEY}"
|
| 163 |
fi
|
| 164 |
|
| 165 |
-
if [ -z "$MODEL_FOR_CONFIG" ]; then
|
| 166 |
-
echo "Missing LLM_MODEL or HERMES_MODEL."
|
| 167 |
-
echo "Add it in HF Spaces -> Settings -> Variables or Secrets."
|
| 168 |
-
exit 1
|
| 169 |
-
fi
|
| 170 |
-
|
| 171 |
export MODEL_FOR_CONFIG PROVIDER_FOR_CONFIG
|
| 172 |
export CUSTOM_BASE_URL="${CUSTOM_BASE_URL:-}"
|
| 173 |
export CUSTOM_API_KEY="${CUSTOM_API_KEY:-${LLM_API_KEY:-}}"
|
|
@@ -195,12 +189,20 @@ try:
|
|
| 195 |
except FileNotFoundError:
|
| 196 |
config = {}
|
| 197 |
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
custom_base = os.environ.get("CUSTOM_BASE_URL", "").strip()
|
| 203 |
-
if custom_base:
|
| 204 |
model["base_url"] = custom_base.rstrip("/")
|
| 205 |
if os.environ.get("CUSTOM_API_KEY"):
|
| 206 |
model["api_key"] = os.environ["CUSTOM_API_KEY"]
|
|
@@ -235,8 +237,8 @@ path.chmod(0o600)
|
|
| 235 |
PY
|
| 236 |
|
| 237 |
echo ""
|
| 238 |
-
echo "Hermes model : ${MODEL_FOR_CONFIG}"
|
| 239 |
-
echo "Provider : ${PROVIDER_FOR_CONFIG}"
|
| 240 |
echo "Public port : ${PUBLIC_PORT}"
|
| 241 |
if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
| 242 |
echo "Telegram : enabled"
|
|
|
|
| 162 |
[ -n "$LLM_API_KEY" ] && export OPENAI_API_KEY="${OPENAI_API_KEY:-$LLM_API_KEY}"
|
| 163 |
fi
|
| 164 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
export MODEL_FOR_CONFIG PROVIDER_FOR_CONFIG
|
| 166 |
export CUSTOM_BASE_URL="${CUSTOM_BASE_URL:-}"
|
| 167 |
export CUSTOM_API_KEY="${CUSTOM_API_KEY:-${LLM_API_KEY:-}}"
|
|
|
|
| 189 |
except FileNotFoundError:
|
| 190 |
config = {}
|
| 191 |
|
| 192 |
+
model_name = os.environ.get("MODEL_FOR_CONFIG", "").strip()
|
| 193 |
+
provider_name = os.environ.get("PROVIDER_FOR_CONFIG", "").strip()
|
| 194 |
+
|
| 195 |
+
if model_name:
|
| 196 |
+
model = config.setdefault("model", {})
|
| 197 |
+
model["default"] = model_name
|
| 198 |
+
if provider_name:
|
| 199 |
+
model["provider"] = provider_name
|
| 200 |
+
else:
|
| 201 |
+
model = config.get("model", {})
|
| 202 |
+
print("No LLM_MODEL/HERMES_MODEL set; leaving Hermes model config unchanged.")
|
| 203 |
|
| 204 |
custom_base = os.environ.get("CUSTOM_BASE_URL", "").strip()
|
| 205 |
+
if custom_base and model_name:
|
| 206 |
model["base_url"] = custom_base.rstrip("/")
|
| 207 |
if os.environ.get("CUSTOM_API_KEY"):
|
| 208 |
model["api_key"] = os.environ["CUSTOM_API_KEY"]
|
|
|
|
| 237 |
PY
|
| 238 |
|
| 239 |
echo ""
|
| 240 |
+
echo "Hermes model : ${MODEL_FOR_CONFIG:-using Hermes default/restored config}"
|
| 241 |
+
echo "Provider : ${PROVIDER_FOR_CONFIG:-using Hermes default/restored config}"
|
| 242 |
echo "Public port : ${PUBLIC_PORT}"
|
| 243 |
if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then
|
| 244 |
echo "Telegram : enabled"
|