feat: 重命名项目为Boardware Genius并添加运行时环境同步功能

- 将项目品牌从nanobot重命名为Boardware Genius,更新所有相关文档、注释和日志输出
- 在web服务器中添加运行时环境变量同步功能,支持授权和后端身份配置
- 更新create-instance脚本以生成运行时环境文件
- 添加实例后端绑定功能到部署控制服务
- 修改入口脚本以加载运行时环境变量
- 更新前端和认证门户的相关描述文本
This commit is contained in:
2026-03-18 15:45:42 +08:00
parent b6dd0c1623
commit 4e45f8b717
36 changed files with 315 additions and 76 deletions

View File

@ -1,4 +1,4 @@
"""nanobot 命令行入口。
"""Boardware Genius 命令行入口。
本文件职责:
1. 定义所有 CLI 命令onboard / agent / gateway / cron / channels / provider
@ -29,12 +29,12 @@ from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.history import FileHistory
from prompt_toolkit.patch_stdout import patch_stdout
from nanobot import __version__, __logo__
from nanobot import __brand__, __version__
from nanobot.config.schema import Config
app = typer.Typer(
name="nanobot",
help=f"{__logo__} nanobot - Personal AI Assistant",
help=f"{__brand__} - Personal AI Assistant",
no_args_is_help=True,
)
@ -122,7 +122,7 @@ def _print_agent_response(response: str, render_markdown: bool) -> None:
content = response or ""
body = Markdown(content) if render_markdown else Text(content)
console.print()
console.print(f"[cyan]{__logo__} nanobot[/cyan]")
console.print(f"[cyan]{__brand__}[/cyan]")
console.print(body)
console.print()
@ -158,7 +158,7 @@ async def _read_interactive_input_async() -> str:
def version_callback(value: bool):
"""处理 --version/-v 选项并立即退出。"""
if value:
console.print(f"{__logo__} nanobot v{__version__}")
console.print(f"{__brand__} v{__version__}")
raise typer.Exit()
@ -168,7 +168,7 @@ def main(
None, "--version", "-v", callback=version_callback, is_eager=True
),
):
"""nanobot - Personal AI Assistant."""
"""Boardware Genius - Personal AI Assistant."""
pass
@ -179,7 +179,7 @@ def main(
@app.command()
def onboard():
"""Initialize nanobot configuration and workspace."""
"""Initialize Boardware Genius configuration and workspace."""
from nanobot.config.loader import get_config_path, load_config, save_config
from nanobot.config.schema import Config
from nanobot.utils.helpers import get_workspace_path
@ -225,11 +225,11 @@ def onboard():
_create_workspace_templates(workspace)
# 第 5 步:输出下一步操作提示,指导用户继续配置 API Key 并开始对话。
console.print(f"\n{__logo__} nanobot is ready!")
console.print(f"\n{__brand__} is ready!")
console.print("\nNext steps:")
console.print(" 1. Add your API key to [cyan]~/.nanobot/config.json[/cyan]")
console.print(" Get one at: https://openrouter.ai/keys")
console.print(" 2. Chat: [cyan]nanobot agent -m \"Hello!\"[/cyan]")
console.print(" 2. Chat with Boardware Genius: [cyan]nanobot agent -m \"Hello!\"[/cyan]")
console.print("\n[dim]Want Telegram/WhatsApp? See: https://github.com/HKUDS/nanobot#-chat-apps[/dim]")
@ -324,7 +324,7 @@ def gateway(
port: int = typer.Option(18790, "--port", "-p", help="Gateway port"),
verbose: bool = typer.Option(False, "--verbose", "-v", help="Verbose output"),
):
"""启动 nanobot 网关常驻服务。
"""启动 Boardware Genius 网关常驻服务。
这是“生产运行入口”之一,主要职责:
1. 初始化配置、总线、模型提供方、会话管理、Agent 主循环;
@ -352,7 +352,7 @@ def gateway(
import logging
logging.basicConfig(level=logging.DEBUG)
console.print(f"{__logo__} Starting nanobot gateway on port {port}...")
console.print(f"{__brand__}: starting gateway on port {port}...")
# 运行时核心对象初始化顺序:
# config -> bus -> provider -> sessions -> cron -> agent -> channels -> heartbeat
@ -525,7 +525,7 @@ def web(
config = load_config()
_create_workspace_templates(config.workspace_path)
console.print(f"{__logo__} Starting nanobot web backend on {host}:{port}...")
console.print(f"{__brand__}: starting web backend on {host}:{port}...")
web_app = create_app(config=config)
uvicorn.run(web_app, host=host, port=port)
@ -541,7 +541,7 @@ def agent(
message: str = typer.Option(None, "--message", "-m", help="Message to send to the agent"),
session_id: str = typer.Option("cli:direct", "--session", "-s", help="Session ID"),
markdown: bool = typer.Option(True, "--markdown/--no-markdown", help="Render assistant output as Markdown"),
logs: bool = typer.Option(False, "--logs/--no-logs", help="Show nanobot runtime logs during chat"),
logs: bool = typer.Option(False, "--logs/--no-logs", help="Show Boardware Genius runtime logs during chat"),
):
"""直接与 agent 交互(单轮模式或交互模式)。
@ -614,7 +614,7 @@ def agent(
# 空上下文:进入/退出都不做事,仅用于统一 with 接口。
return nullcontext()
# 非日志模式下启用转圈动画,提升等待期间的交互感知。
return console.status("[dim]nanobot is thinking...[/dim]", spinner="dots")
return console.status(f"[dim]{__brand__} is thinking...[/dim]", spinner="dots")
async def _cli_progress(content: str, *, tool_hint: bool = False) -> None:
"""CLI 进度回调:按 channels 配置过滤后渲染中间态输出。"""
@ -643,7 +643,7 @@ def agent(
# 初始化 prompt_toolkit 会话(历史记录、编辑能力、粘贴兼容等)。
_init_prompt_session()
# 打印一次交互模式提示,告知退出方式。
console.print(f"{__logo__} Interactive mode (type [bold]exit[/bold] or [bold]Ctrl+C[/bold] to quit)\n")
console.print(f"{__brand__} interactive mode (type [bold]exit[/bold] or [bold]Ctrl+C[/bold] to quit)\n")
# session_id 解析规则:
# 1) 传入 "channel:chat_id" 时,显式使用对应渠道与会话;
@ -945,7 +945,7 @@ def _get_bridge_dir() -> Path:
console.print("Try reinstalling: pip install --force-reinstall nanobot")
raise typer.Exit(1)
console.print(f"{__logo__} Setting up bridge...")
console.print(f"{__brand__}: setting up bridge...")
# 重新复制并构建,确保 bridge 资源与当前版本同步。
user_bridge.parent.mkdir(parents=True, exist_ok=True)
@ -980,7 +980,7 @@ def channels_login():
config = load_config()
bridge_dir = _get_bridge_dir()
console.print(f"{__logo__} Starting bridge...")
console.print(f"{__brand__}: starting bridge...")
console.print("Scan the QR code to connect.\n")
# 可选注入 BRIDGE_TOKEN 做 bridge 鉴权。
@ -1259,14 +1259,14 @@ def cron_run(
@app.command()
def status():
"""展示 nanobot 运行配置与 provider 状态概览。"""
"""展示 Boardware Genius 运行配置与 provider 状态概览。"""
from nanobot.config.loader import load_config, get_config_path
config_path = get_config_path()
config = load_config()
workspace = config.workspace_path
console.print(f"{__logo__} nanobot Status\n")
console.print(f"{__brand__} Status\n")
console.print(f"Config: {config_path} {'[green]✓[/green]' if config_path.exists() else '[red]✗[/red]'}")
console.print(f"Workspace: {workspace} {'[green]✓[/green]' if workspace.exists() else '[red]✗[/red]'}")
@ -1346,7 +1346,7 @@ def provider_login(
console.print(f"[red]Login not implemented for {spec.label}[/red]")
raise typer.Exit(1)
console.print(f"{__logo__} OAuth Login - {spec.label}\n")
console.print(f"{__brand__} OAuth Login - {spec.label}\n")
handler()