Repository navigation
Windows installer and GUI app (v0.1.0) - #3
Merged
Merged
Conversation
Mirrors the smart-citizen / sc-profile-editor build recipe so end users can run the bot locally on Windows while still talking to the shared Railway PostgreSQL. Each install is paired with the user's own Discord token, collected via an Inno Setup wizard page and written to %APPDATA%\Osiris DevWorks\Super TTS\.env. Code changes (all backwards-compatible; Docker/Railway run path unchanged): - main.py: load .env from %APPDATA% first, fall back to original load_dotenv() in dev/Docker; friendlier "missing token" error with a pause prompt only when frozen; skip the import-time exit when SUPER_TTS_GUI_MODE=1 so the upcoming GUI can import this module. - tts_module/tts.py: resolve config/config.yaml via _MEIPASS-aware helper so it works under PyInstaller; identical to old behavior in dev/Docker. - common/constants.py: route logs to %LOCALAPPDATA% only when frozen; swap the racy mkdir for makedirs(exist_ok=True). New build artifacts: - VERSION.TXT (single source of truth, optional --increment bumping) - scripts/build/build_exe.py (PyInstaller onedir, --noupx, --collect-all for supertonic + onnxruntime, --exclude-module for dead Coqui-TTS path) - scripts/build/build_all.bat (clean -> build -> ISCC) - installer.iss (Inno Setup, %LOCALAPPDATA% target, no admin, post-install token wizard, preserves existing .env on reinstall) .gitignore: anchor "build/" rule to repo root so scripts/build/ is tracked. CLAUDE.md added with project orientation for future Claude Code sessions. Note: installer.iss has a placeholder DATABASE_URL (#define on line 22) that must be replaced with the real Railway public-proxy URL before producing a release build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a Windows desktop GUI that wraps the existing bot's asyncio main function in a QThread so the UI stays responsive while discord.py runs. The GUI is the entry point for the installer build only — Docker/Railway keep using main.py directly and never load the gui/ package. Style mirrors smart-citizen/src/gui: - 4-theme palette system (Light / Dark / SCLE / ODW), default ODW (Osiris DevWorks navy + antique gold). Theme swap is live via QApplication palette + QSS rule (no .qss files); secondary text uses the role=secondary property pattern. - LogTab with QPlainTextEdit + Qt-bridge logging handler and per-level color coding, max 2000 lines, export-to-file. - Tabs: Status | Settings | Logs | About. Branded title header above. - Tooltip wake-up tuned to 800ms via a Fusion proxy style. Status tab: - Connection dot + status label (Disconnected / Connecting / Connected / Error), auto-connects on launch when a token is configured. - Connect/Disconnect button. Discord.py only allows one start() per Bot instance, so re-connect requires app relaunch — surfaced as a note under the disabled button. Settings tab: - Token + DATABASE_URL + log level persisted to %APPDATA%\Osiris DevWorks\Super TTS\.env (same path the installer writes during install, interchangeable with hand-edited .env files). - Theme persisted to QSettings (HKCU\Software\Osiris DevWorks\Super TTS). - Show/Hide toggles for the masked credential fields. main.py change (single line): re-read DISCORD_TOKEN from os.environ inside main() so the GUI can update it after the user enters a token in Settings without restarting. Docker/Railway behavior unchanged (the env var doesn't change in those environments). Build: - gui_main.py is the new PyInstaller entry point. - build_exe.py switches to gui_main.py, adds --windowed (no console), --collect-submodules=PyQt6, and hidden imports for every gui.* and in-tree module. - build_all.bat now also pip-installs PyQt6 alongside pyinstaller. PyQt6 is intentionally NOT added to pyproject.toml — installing it via pip in build_all.bat keeps poetry.lock untouched so Docker/Railway builds keep working bit-for-bit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The installer no longer prompts for a Discord token or writes a .env
file. It just lays the binaries down, creates the Start Menu shortcut,
and launches the app — exactly the "all-in-one binary, configure inside
the app" flow the user expected.
Why the previous design felt off: smart-citizen's installer wizard
prompts for paths (SC directory, OneDrive override) which feel natural
during install. A Discord bot token doesn't — most users haven't created
the bot yet when they click Install, and asking up front confuses the
first-run experience.
What changes:
- installer.iss: dropped the [Code] section (TokenPage / CurStepChanged)
and the #define DATABASE_URL constant. Setup is now files + icons +
run, no wizard prompts beyond Inno's standard License/InstallDir pages.
- gui/settings.py: added DEFAULT_DATABASE_URL constant (the operator-
baked Railway public-proxy URL placeholder). The installer used to
write this into .env at install time; now the GUI pre-fills the
Settings tab's Database URL field with it on first launch instead.
Added DEFAULT_LOG_LEVEL for symmetry.
- gui/settings_tab.py:
- Pre-fill the Database URL field with DEFAULT_DATABASE_URL when .env
is missing or has an empty DATABASE_URL key. End users typically
just click Save — they never need to know the Railway URL.
- Added a "Need a token? Create one at discord.com/developers..." help
line above the form with intent-checklist guidance. Single most
common support question, addressed before they ask.
- gui/main_window.py: on first launch when no DISCORD_TOKEN is set, the
app opens directly on the Settings tab so users land on the form they
need to fill in. Subsequent launches (token present) open on Status
and auto-connect as before.
Operator workflow on rotation:
- Edit DEFAULT_DATABASE_URL in gui/settings.py
- Rebuild installer with scripts\build\build_all.bat
- Redistribute. Users' existing .env files keep their saved token
(and, if they edited it, their saved DB URL); new installs pick up
the new default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Match main.py's resolution order exactly so dev-mode launches (`poetry run python gui_main.py` from the repo) pick up an existing project-root .env on the Status tab from launch — previously the bot thread loaded it on main.py import, so the Status tab would briefly show "No token" even when one was configured. Production install behavior unchanged: the %APPDATA% .env is checked first, and falls back to the CWD search only when it's missing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OWNER_ID and TTS_DEVICE were documented but never actually consumed (RAILWAY_ENV_VARS.md even flagged OWNER_ID as "Never referenced in code"). Without these wired, end users had no path to enable admin commands or flip CPU/CUDA on their hardware. Bot side: - main.py now passes OWNER_ID through to the Bot constructor so is_admin_or_owner actually recognizes the install owner. - tts/engine_factory.py honors TTS_DEVICE env var with config.yaml as the fallback, so a CUDA-capable user can toggle GPU without editing the bundled config. GUI side: - Settings tab gains Owner ID, HuggingFace Token (masked + show toggle), and TTS Device fields with inline help text pointing at Discord Developer Mode and HuggingFace token settings. - Empty Owner ID / HF token entries are skipped on save so a user hand-editing .env doesn't get clobbered by an empty GUI field.
Twelve slash command handlers were calling interaction.response.send_message *after* one or more DB queries. Discord invalidates an interaction after 3 seconds, so any user running the bot far from the database (the typical installer scenario, where the bot machine is on a different continent from Railway) hit "10062 Unknown interaction" errors. Confirmed in the wild on /admin_voice subscription-info. Fix is mechanical: defer immediately after the cheap pre-checks (initialized + db model setup), then use interaction.followup.send for all subsequent replies. Pattern matches the existing cleanup-expired and reassign-voice handlers that were already correct. Handlers patched: setup add/remove/list, grant/revoke/list/info subscription, speed, voice list/set, claim/release voice. Plus subscription-info specifically (the one we caught failing in the GUI logs). DISCORD_SETUP.md was a minimal dev-flow doc; rewritten as a complete end-user guide that walks through application creation, intent setup, token + OWNER_ID retrieval (with Developer Mode), invite URL generation, configuration via either GUI Settings tab or .env, and a troubleshooting section covering the gotchas we hit during testing (4006 disconnects from shared tokens, intent misconfig, slash propagation delay, model download rate limits).
Two issues surfaced producing the first installer: build_all.bat tested for the onedir output with `if exist "dist\Super-TTS-v*\"`, but cmd's `if exist` doesn't expand wildcards on directory names. A successful PyInstaller build was being falsely flagged as missing, and the script then hit `pause` and hung waiting for input. Read VERSION.TXT and check the exact folder name instead. installer.iss declared `ArchitecturesAllowed=x64`, which Inno Setup 6.7+ has deprecated in favor of `x64compatible`. Switching keeps the build warning-free and stays compatible with future Inno Setup releases (the latter is the documented preferred form).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Packages Super TTS as a downloadable Windows installer alongside the existing Docker / Railway path. Same bot code, two delivery modes —
gui_main.pyis the PyInstaller entry point used by the installer;main.pyis unchanged for Docker / Railway.What's in this branch (7 commits)
scripts/build/build_exe.py(PyInstaller onedir,--windowed,--noupx, ~500 MB bundle),installer.iss(Inno Setup, no[Code]block — config happens in the GUI),scripts/build/build_all.bat,VERSION.TXT.gui/package..envconfig surface at `%APPDATA%\Osiris DevWorks\Super TTS.env` — Settings tab is the sole config UI; installer doesn't prompt for credentials.OWNER_IDandTTS_DEVICEfinally consumed by the bot. Both were documented as required env vars but never read in code (`RAILWAY_ENV_VARS.md` even flagged `OWNER_ID` as "Never referenced"). `main.py` now passes `OWNER_ID` to the Bot constructor; `tts/engine_factory.py` honors `TTS_DEVICE` over `config.yaml`.Test status
Plan after merge
Tag `v0.1.0` on main, run `gh release create v0.1.0` with `.release-notes-v0.1.0.md` and the installer .exe as the asset.