Spaces:
Running on Zero
Running on Zero
menu: loopback api backend reads 'running on this machine', not generic 'api' (the hosted Space serves the real Warden over localhost)
Browse files- scrypt/ui/menu.py +9 -0
scrypt/ui/menu.py
CHANGED
|
@@ -147,6 +147,15 @@ class MenuScreen(Screen):
|
|
| 147 |
"api": "the Warden is awake (api)",
|
| 148 |
"scripted": "the Warden talks in its sleep (scripted lines)",
|
| 149 |
}[self.backend_mode]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
if self.backend_error:
|
| 151 |
reason = self.backend_error.splitlines()[0][:90]
|
| 152 |
brain += f"\nwhy: {reason}"
|
|
|
|
| 147 |
"api": "the Warden is awake (api)",
|
| 148 |
"scripted": "the Warden talks in its sleep (scripted lines)",
|
| 149 |
}[self.backend_mode]
|
| 150 |
+
# On the hosted Space the model runs in-process and the game reaches
|
| 151 |
+
# it over a loopback API — that's the real finetuned Warden, not a
|
| 152 |
+
# remote service, so don't make it read like a third-party "api".
|
| 153 |
+
if self.backend_mode == "api":
|
| 154 |
+
import os
|
| 155 |
+
|
| 156 |
+
base = os.environ.get("SCRYPT_API_BASE", "")
|
| 157 |
+
if "127.0.0.1" in base or "localhost" in base:
|
| 158 |
+
brain = "the Warden is awake (running on this machine)"
|
| 159 |
if self.backend_error:
|
| 160 |
reason = self.backend_error.splitlines()[0][:90]
|
| 161 |
brain += f"\nwhy: {reason}"
|