Spaces:
Sleeping
Sleeping
HomePilot Deploy Bot commited on
Commit Β·
66c5a2b
1
Parent(s): 4cace01
chore: sync installer from monorepo
Browse files- server.py +30 -0
- static/index.html +8 -1
server.py
CHANGED
|
@@ -61,6 +61,10 @@ async def install(request: Request):
|
|
| 61 |
space_name = body.get("space_name", "HomePilot")
|
| 62 |
private = body.get("private", True)
|
| 63 |
model = body.get("model", "qwen2.5:1.5b")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
if not token or not username:
|
| 66 |
return JSONResponse({"ok": False, "error": "Missing token/username"})
|
|
@@ -127,6 +131,32 @@ async def install(request: Request):
|
|
| 127 |
f"OLLAMA_MODEL=${{OLLAMA_MODEL:-{model}}}"))
|
| 128 |
steps.append(f"Modelo: {model}")
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
# Git push
|
| 131 |
subprocess.run(["git", "lfs", "install", "--local"],
|
| 132 |
capture_output=True, cwd=str(sp))
|
|
|
|
| 61 |
space_name = body.get("space_name", "HomePilot")
|
| 62 |
private = body.get("private", True)
|
| 63 |
model = body.get("model", "qwen2.5:1.5b")
|
| 64 |
+
# Additive: default True preserves current behavior exactly.
|
| 65 |
+
# Set to False to ship a clean HomePilot without the Chata
|
| 66 |
+
# persona pack pre-installed.
|
| 67 |
+
include_personas = bool(body.get("include_personas", True))
|
| 68 |
|
| 69 |
if not token or not username:
|
| 70 |
return JSONResponse({"ok": False, "error": "Missing token/username"})
|
|
|
|
| 131 |
f"OLLAMA_MODEL=${{OLLAMA_MODEL:-{model}}}"))
|
| 132 |
steps.append(f"Modelo: {model}")
|
| 133 |
|
| 134 |
+
# Additive: honor include_personas toggle.
|
| 135 |
+
# - include_personas=True (default): chata-personas bundle stays; the
|
| 136 |
+
# in-container bootstrap auto-populates Projects on first boot.
|
| 137 |
+
# - include_personas=False: we inject an explicit disable into start.sh
|
| 138 |
+
# AND delete the bundled chata-personas directory so the user's
|
| 139 |
+
# HomePilot boots completely clean.
|
| 140 |
+
if not include_personas and start.exists():
|
| 141 |
+
st = start.read_text()
|
| 142 |
+
if "ENABLE_PROJECT_BOOTSTRAP" not in st:
|
| 143 |
+
marker = "# ββ Environment ββββββββββββββββββββββββββββββββββββββββββ"
|
| 144 |
+
st = st.replace(
|
| 145 |
+
marker,
|
| 146 |
+
marker + "\nexport ENABLE_PROJECT_BOOTSTRAP=false",
|
| 147 |
+
1,
|
| 148 |
+
)
|
| 149 |
+
start.write_text(st)
|
| 150 |
+
for cand in ("chata-personas",
|
| 151 |
+
"deploy/huggingface-space/chata-personas"):
|
| 152 |
+
d = sp / cand
|
| 153 |
+
if d.exists():
|
| 154 |
+
shutil.rmtree(d, ignore_errors=True)
|
| 155 |
+
steps.append("Chata personas: omitted (clean install)")
|
| 156 |
+
else:
|
| 157 |
+
steps.append("Chata personas: included (auto-imported on first boot)")
|
| 158 |
+
|
| 159 |
+
|
| 160 |
# Git push
|
| 161 |
subprocess.run(["git", "lfs", "install", "--local"],
|
| 162 |
capture_output=True, cwd=str(sp))
|
static/index.html
CHANGED
|
@@ -275,6 +275,12 @@ a:hover{color:var(--cyan)}
|
|
| 275 |
<option value="gemma:2b">gemma 2b β balanced</option>
|
| 276 |
</select>
|
| 277 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
</div>
|
| 279 |
</div>
|
| 280 |
|
|
@@ -561,7 +567,8 @@ $('#install-btn').onclick = async () => {
|
|
| 561 |
username,
|
| 562 |
space_name: $('#space-name').value.trim() || 'HomePilot',
|
| 563 |
private: $('#private').checked,
|
| 564 |
-
model: $('#model').value
|
|
|
|
| 565 |
})
|
| 566 |
});
|
| 567 |
const d = await r.json();
|
|
|
|
| 275 |
<option value="gemma:2b">gemma 2b β balanced</option>
|
| 276 |
</select>
|
| 277 |
</div>
|
| 278 |
+
<div class="field">
|
| 279 |
+
<label class="toggle" id="lbl-personas">
|
| 280 |
+
<input type="checkbox" id="include-personas" checked>
|
| 281 |
+
<span id="txt-personas">Include Chata personas (14 Starter + Retro pack)</span>
|
| 282 |
+
</label>
|
| 283 |
+
</div>
|
| 284 |
</div>
|
| 285 |
</div>
|
| 286 |
|
|
|
|
| 567 |
username,
|
| 568 |
space_name: $('#space-name').value.trim() || 'HomePilot',
|
| 569 |
private: $('#private').checked,
|
| 570 |
+
model: $('#model').value,
|
| 571 |
+
include_personas: $('#include-personas') ? $('#include-personas').checked : true
|
| 572 |
})
|
| 573 |
});
|
| 574 |
const d = await r.json();
|