fix(webui): resume incomplete model setup in the browser
This commit is contained in:
1 parent
7ed79fe309
commit
0b1fa0c3e4
3 files changed
+32
-62
No files matched your search
+1
-12
@@ -27,7 +27,6 @@ from nanobot.cli.webui_support import (
|
||||
_prepare_webui_bundle_for_gateway,
|
||||
_print_foreground_port_conflict,
|
||||
_resolve_webui_config_path,
|
||||
_run_quick_start_for_webui,
|
||||
_tcp_endpoint_reachable,
|
||||
_warn_webui_bind_scope,
|
||||
_webui_browser_url,
|
||||
@@ -143,19 +142,9 @@ def webui(
|
||||
raise typer.Exit(1) from exc
|
||||
|
||||
provider_error = _provider_setup_error(resolved_setup_config)
|
||||
settings_setup_error = provider_error if provider_error and created_config else None
|
||||
if settings_setup_error:
|
||||
if provider_error:
|
||||
console.print(f"[yellow]Model setup is incomplete: {provider_error}[/yellow]")
|
||||
console.print("Configure a provider and model in WebUI Settings → Models.")
|
||||
elif provider_error:
|
||||
console.print(f"[dim]Provider check: {provider_error}[/dim]")
|
||||
setup_config = _run_quick_start_for_webui(
|
||||
setup_config,
|
||||
yes=yes,
|
||||
config_path=config_path,
|
||||
)
|
||||
if workspace:
|
||||
setup_config.agents.defaults.workspace = workspace
|
||||
|
||||
try:
|
||||
changed_webui, generated_bootstrap_secret = _ensure_local_webui_channel(
|
||||
|
||||
@@ -50,7 +50,6 @@ __all__ = [
|
||||
"_print_foreground_port_conflict",
|
||||
"_print_webui_foreground_lifecycle",
|
||||
"_resolve_webui_config_path",
|
||||
"_run_quick_start_for_webui",
|
||||
"_tcp_endpoint_reachable",
|
||||
"_validate_gateway_startup",
|
||||
"_warn_webui_bind_scope",
|
||||
@@ -574,43 +573,3 @@ def _gateway_instance_command(
|
||||
workspace_path = str(Path(workspace).expanduser().resolve(strict=False))
|
||||
parts.extend(["--workspace", workspace_path])
|
||||
return " ".join(shlex.quote(part) for part in parts)
|
||||
|
||||
|
||||
def _run_quick_start_for_webui(
|
||||
config: Config,
|
||||
*,
|
||||
yes: bool,
|
||||
config_path: Path,
|
||||
) -> Config:
|
||||
"""Offer the existing Quick Start flow when provider setup is missing."""
|
||||
if yes:
|
||||
console.print(
|
||||
"[red]Error: provider/model setup is incomplete, and --yes cannot answer "
|
||||
"provider credentials.[/red]"
|
||||
)
|
||||
console.print("Complete provider/model setup:")
|
||||
_print_model_setup_steps(config_path)
|
||||
raise typer.Exit(1)
|
||||
|
||||
console.print()
|
||||
console.print("[yellow]Model provider setup is not ready.[/yellow]")
|
||||
console.print(
|
||||
"Quick Start will ask for provider, API key/base URL, model, and WebUI password."
|
||||
)
|
||||
_confirm_webui_action("Run Quick Start now?", yes=False)
|
||||
|
||||
from nanobot.cli.onboard import run_quick_start_onboard
|
||||
|
||||
try:
|
||||
result = run_quick_start_onboard(config)
|
||||
except RuntimeError as exc:
|
||||
console.print(f"[red]Error: {exc}[/red]")
|
||||
console.print(
|
||||
"[yellow]Run `nanobot onboard --wizard` "
|
||||
"after installing wizard dependencies.[/yellow]"
|
||||
)
|
||||
raise typer.Exit(1) from exc
|
||||
if not result.should_save:
|
||||
console.print("[yellow]Quick Start cancelled. No changes were saved.[/yellow]")
|
||||
raise typer.Exit(1)
|
||||
return result.config
|
||||
Reference in new issue
Block a user