Files
hermes 65c2ea3d50 feat(pinokio): clean one-click launcher for multi-tts-server
- install: clone app source, create venv, install deps + torch + models
- start: daemon uvicorn on 127.0.0.1 with auto-captured URL
- reset: remove venv/cache/models but keep source
- update: pull both launcher and app, then re-install
- sanitized: no local env details, no TODO/DONE
- icon.png included
2026-07-04 01:38:23 +08:00

49 lines
1.5 KiB
JavaScript

// Multi-TTS-Server launcher daemon.
// Runs uvicorn in the background and exposes the URL via local.set so the
// menu can render an "Open Web UI" button.
module.exports = {
requires: { bundle: "ai" },
daemon: true,
run: [
{
method: "shell.run",
params: {
venv: "venv",
path: "app",
env: {
// Workaround for Coqui TTS on Windows when no system Local AppData is available
TTS_HOME: "{{cwd}}\\app\\cache\\tts_home",
HF_HOME: "{{cwd}}\\app\\cache\\hf",
XDG_DATA_HOME: "{{cwd}}\\app\\cache\\appdata",
LOCALAPPDATA: "{{cwd}}\\app\\cache\\appdata",
TRANSFORMERS_CACHE: "{{cwd}}\\app\\cache\\hf",
HF_HUB_CACHE: "{{cwd}}\\app\\cache\\hf",
PYTHONUTF8: "1",
},
message: [
"python -m uvicorn app.main:app --host 127.0.0.1 --port {{port}}"
],
on: [
// Watch stdout for uvicorn's "Uvicorn running on..." line and capture URL.
// The single capture group is fed to local.set.url below via input.event[1].
{
"event": "/Uvicorn running on (https?:\\/\\/[^\\s]+)/",
"done": true
},
{
"event": "/error:/i",
"break": false
}
]
}
},
{
method: "local.set",
params: {
// input.event[1] is the first capture group from the regex (the URL).
url: "{{input.event && input.event[1] ? input.event[1] : ''}}"
}
}
]
}