Add --remote support to reload command

Now uses default remote like other commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-14 02:59:21 +01:00
parent e77bc670d7
commit 29142c7b2b
+6 -3
View File
@@ -558,13 +558,16 @@ def status(
@app.command() @app.command()
def reload( def reload(
model: Annotated[str, typer.Option(help="Path to model file for sd-server.")], model: Annotated[str, typer.Option(help="Path to model file for sd-server.")],
host: Annotated[str, typer.Option(help="Wrapper API host.")] = "127.0.0.1", remote: Annotated[str | None, typer.Option("-r", "--remote", help="Remote server name or URL")] = None,
port: Annotated[int, typer.Option(help="Wrapper API port.")] = 8080, host: Annotated[str, typer.Option(help="Wrapper API host (local mode).")] = "127.0.0.1",
port: Annotated[int, typer.Option(help="Wrapper API port (local mode).")] = 8080,
) -> None: ) -> None:
"""Reload sd-server with a new model.""" """Reload sd-server with a new model."""
import httpx # noqa: PLC0415 import httpx # noqa: PLC0415
url = f"http://{host}:{port}/reload" remote_url = resolve_remote(remote)
url = f"{remote_url.rstrip('/')}/reload" if remote_url else f"http://{host}:{port}/reload"
console.print(f"[cyan]Reloading model: {model}[/cyan]") console.print(f"[cyan]Reloading model: {model}[/cyan]")
try: try:
resp = httpx.post(url, json={"model": model}, timeout=300) resp = httpx.post(url, json={"model": model}, timeout=300)