用户
用户名: nanobot
网关服务运行于 nanobot 用户
有两种方式访问系统。
1. 以 nanobot 身份直接通过 SSH 登录
ssh nanobot@<SERVER_IP>
密码:
cat /root/.cloudzy-creds
2. 以 root 登录后切换用户
ssh root@<SERVER_IP>
su - nanobot
用法
0. 通过 SSH 连接服务器
以 root 身份连接到服务器:
ssh root@<SERVER_IP>
使用密码登录。
1. 切换到应用用户
su - nanobot
Nanobot 不能以 root 用户身份运行。
2. 配置
编辑配置文件: /home/nanobot/.nanobot/config.json
在配置中设置以下两个部分(其他选项均有默认值)。
将以下配置块添加或合并到现有配置文件中,而不是替换整个文件。
Providers 块(API 密钥)
设置你的 API 密钥(例如 OpenRouter,推荐全球用户使用):
{
"providers": {
"openrouter": {
"apiKey": "sk-or-v1-xxx"
}
}
}
Agents 块(模型)
设置你的模型(可选择指定 provider,默认自动检测):
{
"agents": {
"defaults": {
"provider": "openrouter",
"model": "anthropic/claude-opus-4-6"
}
}
}
3. 重新启动网关
完成配置后,重启网关服务以使更改生效,并启用与 Telegram 等聊天应用的连接。
sudo systemctl restart nanobot-gateway
nanobot 用户密码:存储于 /root/.cloudzy-creds
4. 聊天
启动交互式聊天:
nanobot agent
发送单条提示词:
nanobot agent -m "Hello!"
Telegram 集成
1. 创建机器人
打开 Telegram:
- 搜索:@BotFather
- 运行
/newbot - 复制 bot token
2. 配置 nanobot
编辑配置 /home/nanobot/.nanobot/config.json
将以下配置块添加或合并到现有配置文件中,而不是替换整个文件。
{
"channels": {
"telegram": {
"enabled": true,
"token": "YOUR_BOT_TOKEN",
"allowFrom": ["YOUR_USER_ID"]
}
}
}
设置 enabled 到 true。
YOUR_BOT_TOKEN 是你通过 BotFather 创建 Telegram bot 时获得的 token。
YOUR_USER_ID 是你的 Telegram 用户 ID,可在 Telegram 设置中找到,显示为 @yourUserId。复制该值时请去掉 @ 符号,然后粘贴到配置文件中。
4. 重新启动服务
sudo systemctl restart nanobot-gateway
重要文件与目录
- 用户主页
/home/nanobot - 应用数据
/home/nanobot/.nanobot - 配置文件:
/home/nanobot/.nanobot/config.json - CLI 二进制文件
/home/nanobot/.local/bin/nanobot - Systemd 服务
/etc/systemd/system/nanobot-gateway.service - 凭据文件:
/root/.cloudzy-creds
笔记
- 每次修改配置后:
systemctl restart nanobot-gateway - 服务将在系统启动时自动运行
- 使用
systemctl和journalctl用于管理 - 重置
nanobot用户密码(以 root 身份):passwd nanobot