ttstoy: remove all TTS server management commands from the bot
The dectalk, morshu, and vox servers are managed entirely by systemd now, so the bot no longer needs to inspect or manage them. Removed the stop and status commands for all three, the unused dectalk_auto_start config, and the dead server directory and process attributes. The cog keeps only the fixed ports it uses to reach the services over HTTP.
This commit is contained in:
+4
-128
@@ -365,19 +365,15 @@ class TtsToy(Cog):
|
|||||||
|
|
||||||
self.tts_storage = cog_data_path(cog_instance=self).joinpath("ttstoy")
|
self.tts_storage = cog_data_path(cog_instance=self).joinpath("ttstoy")
|
||||||
self.sfx_root = Path(__file__).resolve().parent / "sfx"
|
self.sfx_root = Path(__file__).resolve().parent / "sfx"
|
||||||
self.dectalk_dir = Path(__file__).resolve().parent / "dectalk-server"
|
# TTS servers run as independent systemd services; the cog only needs
|
||||||
self.dectalk_process = None
|
# their ports to reach them over HTTP.
|
||||||
self.dectalk_port = 33001
|
self.dectalk_port = 33001
|
||||||
|
|
||||||
# Morshu TTS engine + server
|
# Morshu TTS engine (in-process fallback) + service port
|
||||||
self.morshu = Morshu() if MORSHU_AVAILABLE else None
|
self.morshu = Morshu() if MORSHU_AVAILABLE else None
|
||||||
self.morshu_dir = Path(__file__).resolve().parent / "morshu-server"
|
|
||||||
self.morshu_process = None
|
|
||||||
self.morshu_port = 33002
|
self.morshu_port = 33002
|
||||||
|
|
||||||
# VOX server
|
# VOX service port
|
||||||
self.vox_dir = Path(__file__).resolve().parent / "vox-server"
|
|
||||||
self.vox_process = None
|
|
||||||
self.vox_port = 33003
|
self.vox_port = 33003
|
||||||
|
|
||||||
# TTS queue system - one queue per guild
|
# TTS queue system - one queue per guild
|
||||||
@@ -403,7 +399,6 @@ class TtsToy(Cog):
|
|||||||
tts_mode="minimax",
|
tts_mode="minimax",
|
||||||
chatterbox_api_url=CHATTERBOX_DEFAULT_URL,
|
chatterbox_api_url=CHATTERBOX_DEFAULT_URL,
|
||||||
dectalk_api_url=f"http://127.0.0.1:33001",
|
dectalk_api_url=f"http://127.0.0.1:33001",
|
||||||
dectalk_auto_start=True,
|
|
||||||
accessibility_mode=False,
|
accessibility_mode=False,
|
||||||
vox_pack="vox",
|
vox_pack="vox",
|
||||||
webui_tts_channel_id=None, # channel to post web UI TTS transcripts/audio
|
webui_tts_channel_id=None, # channel to post web UI TTS transcripts/audio
|
||||||
@@ -1931,125 +1926,6 @@ class TtsToy(Cog):
|
|||||||
await self.config.dectalk_api_url.set(url)
|
await self.config.dectalk_api_url.set(url)
|
||||||
await ctx.send(f"✅ DECTalk API URL set to: `{url}`")
|
await ctx.send(f"✅ DECTalk API URL set to: `{url}`")
|
||||||
|
|
||||||
@ttstoy_group.command(name="dectalkstop")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def dectalk_stop(self, ctx: commands.Context):
|
|
||||||
"""The DECTalk server is managed by systemd, not the bot."""
|
|
||||||
await ctx.send(
|
|
||||||
"The DECTalk server now runs as an independent systemd service "
|
|
||||||
"(dectalk-tts-server). Manage it with: "
|
|
||||||
"`sudo systemctl stop dectalk-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="dectalkstatus")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def dectalk_status(self, ctx: commands.Context):
|
|
||||||
"""Check DECTalk server status."""
|
|
||||||
auto_start = await self.config.dectalk_auto_start()
|
|
||||||
dectalk_url = await self._get_dectalk_api_url()
|
|
||||||
|
|
||||||
# Check if installed
|
|
||||||
server_js = self.dectalk_dir / "server.js"
|
|
||||||
node_modules = self.dectalk_dir / "node_modules"
|
|
||||||
installed = server_js.exists() and node_modules.exists()
|
|
||||||
|
|
||||||
# The service is managed by systemd; report API reachability.
|
|
||||||
# Check if API is responding
|
|
||||||
api_responding = False
|
|
||||||
try:
|
|
||||||
test_url = f"{dectalk_url.rstrip('/')}/health"
|
|
||||||
r = requests.get(test_url, timeout=2)
|
|
||||||
api_responding = r.status_code == 200
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
lines = [
|
|
||||||
"**DECTalk Server Status**",
|
|
||||||
f"Installed: {'✅ Yes' if installed else '❌ No'}",
|
|
||||||
f"API Responding: {'✅ Yes' if api_responding else '❌ No'}",
|
|
||||||
f"Auto-start: {'✅ Enabled' if auto_start else '❌ Disabled'}",
|
|
||||||
f"URL: `{dectalk_url}`",
|
|
||||||
"",
|
|
||||||
]
|
|
||||||
|
|
||||||
if not api_responding:
|
|
||||||
lines.append(
|
|
||||||
"Service managed by systemd. Start with: "
|
|
||||||
"`sudo systemctl start dectalk-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
await ctx.send("\n".join(lines))
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="morshustop")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def morshu_stop(self, ctx: commands.Context):
|
|
||||||
"""The Morshu server is managed by systemd, not the bot."""
|
|
||||||
await ctx.send(
|
|
||||||
"The Morshu server now runs as an independent systemd service "
|
|
||||||
"(morshu-tts-server). Manage it with: "
|
|
||||||
"`sudo systemctl stop morshu-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="morshustatus")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def morshu_status(self, ctx: commands.Context):
|
|
||||||
"""Check Morshu server status."""
|
|
||||||
api_responding = False
|
|
||||||
try:
|
|
||||||
r = requests.get(f"http://127.0.0.1:{self.morshu_port}/health", timeout=2)
|
|
||||||
api_responding = r.status_code == 200
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
lines = [
|
|
||||||
"**Morshu Server Status**",
|
|
||||||
f"API Responding: {'✅ Yes' if api_responding else '❌ No'}",
|
|
||||||
f"URL: `http://127.0.0.1:{self.morshu_port}`",
|
|
||||||
]
|
|
||||||
|
|
||||||
if not api_responding:
|
|
||||||
lines.append(
|
|
||||||
"\nService managed by systemd. Start with: "
|
|
||||||
"`sudo systemctl start morshu-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
await ctx.send("\n".join(lines))
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="voxstop")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def vox_stop(self, ctx: commands.Context):
|
|
||||||
"""The VOX server is managed by systemd, not the bot."""
|
|
||||||
await ctx.send(
|
|
||||||
"The VOX server now runs as an independent systemd service "
|
|
||||||
"(vox-tts-server). Manage it with: "
|
|
||||||
"`sudo systemctl stop vox-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="voxstatus")
|
|
||||||
@commands.is_owner()
|
|
||||||
async def vox_status(self, ctx: commands.Context):
|
|
||||||
"""Check VOX server status."""
|
|
||||||
api_responding = False
|
|
||||||
try:
|
|
||||||
r = requests.get(f"http://127.0.0.1:{self.vox_port}/health", timeout=2)
|
|
||||||
api_responding = r.status_code == 200
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
lines = [
|
|
||||||
"**VOX Server Status**",
|
|
||||||
f"API Responding: {'✅ Yes' if api_responding else '❌ No'}",
|
|
||||||
f"URL: `http://127.0.0.1:{self.vox_port}`",
|
|
||||||
]
|
|
||||||
|
|
||||||
if not api_responding:
|
|
||||||
lines.append(
|
|
||||||
"\nService managed by systemd. Start with: "
|
|
||||||
"`sudo systemctl start vox-tts-server`"
|
|
||||||
)
|
|
||||||
|
|
||||||
await ctx.send("\n".join(lines))
|
|
||||||
|
|
||||||
@ttstoy_group.command(name="accessibility")
|
@ttstoy_group.command(name="accessibility")
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def accessibility_toggle(self, ctx: commands.Context):
|
async def accessibility_toggle(self, ctx: commands.Context):
|
||||||
|
|||||||
Reference in New Issue
Block a user