mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-05-28 20:41:23 +00:00
chore: temporary keep WebUI source-only
This commit is contained in:
parent
53ba410e49
commit
558aa98491
@ -950,68 +950,6 @@ def _run_gateway(
|
||||
asyncio.run(run())
|
||||
|
||||
|
||||
@app.command()
|
||||
def web(
|
||||
port: int | None = typer.Option(None, "--port", "-p", help="WebSocket port for the webui"),
|
||||
workspace: str | None = typer.Option(None, "--workspace", "-w", help="Workspace directory"),
|
||||
verbose: bool = typer.Option(False, "--verbose", "-v", help="Verbose output"),
|
||||
config: str | None = typer.Option(None, "--config", "-c", help="Path to config file"),
|
||||
open_browser: bool = typer.Option(True, "--open/--no-open", help="Open the browser when ready"),
|
||||
):
|
||||
"""Start the gateway with the embedded webui and (by default) open a browser."""
|
||||
if verbose:
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
cfg = _load_runtime_config(config, workspace)
|
||||
|
||||
# Force the websocket channel on with token-gated auth so the webui is functional.
|
||||
# ``--port`` applies to the webui's websocket/HTTP port, not the gateway's
|
||||
# management port, since that's the only surface users visit.
|
||||
ws_section = cfg.channels.websocket
|
||||
if isinstance(ws_section, dict):
|
||||
ws_section.setdefault("host", "127.0.0.1")
|
||||
ws_section["enabled"] = True
|
||||
ws_section["websocketRequiresToken"] = True
|
||||
if port is not None:
|
||||
ws_section["port"] = port
|
||||
ws_host = ws_section.get("host", "127.0.0.1")
|
||||
ws_port = ws_section.get("port", 8765)
|
||||
ws_path = ws_section.get("path", "/")
|
||||
else:
|
||||
ws_section.enabled = True
|
||||
if hasattr(ws_section, "websocket_requires_token"):
|
||||
ws_section.websocket_requires_token = True
|
||||
if port is not None:
|
||||
ws_section.port = port
|
||||
ws_host = getattr(ws_section, "host", "127.0.0.1") or "127.0.0.1"
|
||||
ws_port = getattr(ws_section, "port", 8765)
|
||||
ws_path = getattr(ws_section, "path", "/") or "/"
|
||||
|
||||
# Confirm the bundled SPA exists before promising the user a browser launch.
|
||||
from nanobot.channels.manager import _default_webui_dist
|
||||
|
||||
dist = _default_webui_dist()
|
||||
if dist is None:
|
||||
console.print(
|
||||
"[yellow]Warning: webui assets not found at nanobot/web/dist/. "
|
||||
"Run `cd webui && bun install && bun run build` from a source checkout.[/yellow]"
|
||||
)
|
||||
|
||||
scheme = "http"
|
||||
# Browsers refuse cookies/JS on 0.0.0.0 — collapse to loopback for the visit URL.
|
||||
visit_host = "127.0.0.1" if ws_host in {"0.0.0.0", "::"} else ws_host
|
||||
open_url = f"{scheme}://{visit_host}:{ws_port}{ws_path if ws_path != '/' else ''}/"
|
||||
|
||||
# The gateway's management port is separate from the webui port; leave it
|
||||
# on its configured default so --port only moves the visible surface.
|
||||
_run_gateway(
|
||||
cfg,
|
||||
open_browser_url=open_url if open_browser else None,
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Agent Commands
|
||||
# ============================================================================
|
||||
|
||||
@ -118,13 +118,6 @@ include = [
|
||||
"nanobot/skills/**/*.md",
|
||||
"nanobot/skills/**/*.sh",
|
||||
]
|
||||
# Build-time generated assets that live under .gitignore'd paths but must ship
|
||||
# in the wheel/sdist. `artifacts` bypasses the VCS filter (unlike `include`).
|
||||
# The webui is compiled via `bun run build` into nanobot/web/dist/ right before
|
||||
# `python -m build` runs.
|
||||
artifacts = [
|
||||
"nanobot/web/dist/**/*",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["nanobot"]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# nanobot webui
|
||||
|
||||
The browser front-end for `nanobot web`. It is built with Vite + React 18 +
|
||||
The browser front-end for the nanobot gateway. It is built with Vite + React 18 +
|
||||
TypeScript + Tailwind 3 + shadcn/ui, talks to the gateway over the WebSocket
|
||||
multiplex protocol, and reads session metadata from the embedded REST surface
|
||||
on the same port.
|
||||
@ -22,7 +22,7 @@ For the project overview, install guide, and general docs map, see the root
|
||||
|
||||
```text
|
||||
webui/ source tree (this directory)
|
||||
nanobot/web/dist/ build output consumed by `nanobot web`
|
||||
nanobot/web/dist/ build output served by the gateway
|
||||
```
|
||||
|
||||
## Develop from source
|
||||
@ -80,7 +80,7 @@ bun run build
|
||||
```
|
||||
|
||||
This writes the production assets to `../nanobot/web/dist`, which is the
|
||||
directory served by `nanobot web` and bundled into the Python wheel.
|
||||
directory served by `nanobot gateway` and bundled into the Python wheel.
|
||||
|
||||
If you are cutting a release, run the build before packaging so the published
|
||||
wheel contains the current WebUI assets.
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "Couldn't reach nanobot",
|
||||
"gatewayHint": "Make sure the gateway is running (`nanobot web`) and that this page is open on the same machine."
|
||||
"gatewayHint": "Make sure the gateway is running (`nanobot gateway`) and that this page is open on the same machine."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "No se pudo conectar con nanobot",
|
||||
"gatewayHint": "Asegúrate de que la gateway esté en ejecución (`nanobot web`) y de que esta página esté abierta en la misma máquina."
|
||||
"gatewayHint": "Asegúrate de que la gateway esté en ejecución (`nanobot gateway`) y de que esta página esté abierta en la misma máquina."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "Impossible de joindre nanobot",
|
||||
"gatewayHint": "Assurez-vous que la gateway est en cours d’exécution (`nanobot web`) et que cette page est ouverte sur la même machine."
|
||||
"gatewayHint": "Assurez-vous que la gateway est en cours d’exécution (`nanobot gateway`) et que cette page est ouverte sur la même machine."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "Tidak dapat menjangkau nanobot",
|
||||
"gatewayHint": "Pastikan gateway sedang berjalan (`nanobot web`) dan halaman ini dibuka pada mesin yang sama."
|
||||
"gatewayHint": "Pastikan gateway sedang berjalan (`nanobot gateway`) dan halaman ini dibuka pada mesin yang sama."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "nanobot に接続できませんでした",
|
||||
"gatewayHint": "gateway(`nanobot web`)が起動しており、このページが同じマシン上で開かれていることを確認してください。"
|
||||
"gatewayHint": "gateway(`nanobot gateway`)が起動しており、このページが同じマシン上で開かれていることを確認してください。"
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "nanobot에 연결할 수 없습니다",
|
||||
"gatewayHint": "gateway(`nanobot web`)가 실행 중인지, 그리고 이 페이지가 같은 머신에서 열려 있는지 확인하세요."
|
||||
"gatewayHint": "gateway(`nanobot gateway`)가 실행 중인지, 그리고 이 페이지가 같은 머신에서 열려 있는지 확인하세요."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "Không thể kết nối tới nanobot",
|
||||
"gatewayHint": "Hãy chắc chắn gateway đang chạy (`nanobot web`) và trang này được mở trên cùng máy."
|
||||
"gatewayHint": "Hãy chắc chắn gateway đang chạy (`nanobot gateway`) và trang này được mở trên cùng máy."
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "无法连接到 nanobot",
|
||||
"gatewayHint": "请确认 gateway 已启动(`nanobot web`),并且当前页面与 gateway 运行在同一台机器上。"
|
||||
"gatewayHint": "请确认 gateway 已启动(`nanobot gateway`),并且当前页面与 gateway 运行在同一台机器上。"
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
},
|
||||
"error": {
|
||||
"title": "無法連線到 nanobot",
|
||||
"gatewayHint": "請確認 gateway 已啟動(`nanobot web`),並且目前頁面與 gateway 在同一台機器上開啟。"
|
||||
"gatewayHint": "請確認 gateway 已啟動(`nanobot gateway`),並且目前頁面與 gateway 在同一台機器上開啟。"
|
||||
},
|
||||
"documentTitle": {
|
||||
"base": "nanobot",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user