🖥️ SSH 远程

NeoWeb AI 内置完整的 SSH 工具集,让 AI 可以直接操作你的远程服务器——执行命令、读写文件、上传下载、一键部署,无需你来回切换终端。

添加服务器

方式一:在 UI 中添加

进入 设置 → SSH 服务器 → 添加服务器,填写:

字段说明示例
名称服务器别名(用于在对话中引用)prod-server
主机IP 地址或域名192.168.1.100
端口SSH 端口(默认 22)22
用户名登录用户ubuntu
认证方式密码或 SSH 私钥

方式二:通过对话添加

直接在对话中描述,AI 会调用 add_server 工具完成添加:

对话示例
你:帮我添加一台服务器,地址是 192.168.1.100,用户名 ubuntu,使用我的默认私钥

AI:我来帮你添加这台服务器。[调用 add_server]
服务器 "ubuntu@192.168.1.100" 已添加,别名为 "server-1"。

SSH 密钥认证(推荐)

建议使用 SSH 密钥而非密码认证,更安全也更便捷:

bash
# 生成 SSH 密钥对(如果还没有)
ssh-keygen -t ed25519 -C "neowebai"

# 将公钥复制到服务器
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server

SSH 工具详解

ssh_exec — 执行命令

在远程服务器上执行任意 Shell 命令:

对话示例
你:查一下 prod-server 上 nginx 的状态

AI:[调用 ssh_exec,命令: systemctl status nginx]
nginx 服务运行正常,已运行 3 天 2 小时...

ssh_read — 读取远程文件

对话示例
你:帮我看看 /etc/nginx/nginx.conf 的内容

AI:[调用 ssh_read,path: /etc/nginx/nginx.conf]
[显示配置文件内容并分析]

ssh_write — 写入远程文件

对话示例
你:在 /etc/nginx/conf.d/ 新建一个 myapp.conf,内容是 [...]

AI:[调用 ssh_write,写入配置文件]
已在远程服务器创建 /etc/nginx/conf.d/myapp.conf

ssh_upload / ssh_download — 文件传输

对话示例
# 上传
你:把本地的 dist/ 目录上传到服务器的 /var/www/html/

# 下载
你:帮我下载服务器上 /var/log/app.log 到本地

ssh_deploy — 一键部署

最强大的 SSH 工具,串联构建、传输、重启全流程:

对话示例
你:帮我把当前项目部署到 prod-server

AI:好的,我来执行部署流程:
1. [构建项目:npm run build]
2. [上传文件:ssh_upload dist/ → /var/www/app/]
3. [重启服务:ssh_exec systemctl restart app]
4. [健康检查:http_get http://prod-server/health]
部署完成!应用运行正常。

find_bug — 远程排障

专为故障排查设计,AI 会自动收集日志、检查进程、分析异常:

对话示例
你:prod-server 上的 app 刚才崩溃了,帮我查一下原因

AI:我来分析一下。[调用 find_bug]
正在检查:
- 应用日志 /var/log/app/error.log
- 系统日志 journalctl
- 内存和 CPU 使用情况
...
发现问题:内存溢出(OOM Kill),建议增加 --max-old-space-size 参数...

安全注意事项

  • SSH 凭据加密存储在本地,不会上传到云端
  • 建议为 NeoWeb AI 创建专用的低权限用户,避免使用 root
  • 可以在服务器设置中限制允许执行的命令范围
  • 所有 SSH 操作都有详细日志记录,可在 日志 面板查看
🔒 NeoWeb AI 的所有数据 100% 存储在本地,你的 SSH 密钥和服务器信息不会离开你的设备。

多服务器管理

你可以添加多台服务器,在对话中通过名称引用:

对话示例
你:在 dev-server 上跑一下测试,通过后再部署到 prod-server

AI:好的,先在 dev-server 执行测试...
[ssh_exec dev-server: npm test] — 全部通过
现在开始部署到 prod-server...
[ssh_deploy → prod-server] — 部署成功

🖥️ SSH Remote

NeoWeb AI has a complete built-in SSH toolkit, letting AI directly operate your remote servers — execute commands, read/write files, upload/download, one-click deploy — no terminal switching needed.

Add a Server

Option 1: Add via UI

Go to Settings → SSH Servers → Add Server and fill in:

FieldDescriptionExample
NameServer alias (used in conversation)prod-server
HostIP address or domain192.168.1.100
PortSSH port (default 22)22
UsernameLogin userubuntu
AuthPassword or SSH private key

Option 2: Add via Conversation

Example
You: Add a server at 192.168.1.100, username ubuntu, use my default key

AI: [Calls add_server]
Server "ubuntu@192.168.1.100" added with alias "server-1".

SSH Key Auth (Recommended)

bash
# Generate SSH key pair
ssh-keygen -t ed25519 -C "neowebai"

# Copy public key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server

SSH Tool Reference

ssh_exec — Execute Commands

Example
You: Check nginx status on prod-server

AI: [Calls ssh_exec: systemctl status nginx]
nginx is running, uptime 3 days 2 hours...

ssh_read / ssh_write — Read & Write Remote Files

Example
You: Show me /etc/nginx/nginx.conf

AI: [Calls ssh_read, path: /etc/nginx/nginx.conf]
[Displays and analyzes config content]

ssh_upload / ssh_download — File Transfer

Example
# Upload
You: Upload local dist/ to /var/www/html/ on the server

# Download
You: Download /var/log/app.log from the server

ssh_deploy — One-click Deploy

Example
You: Deploy current project to prod-server

AI: Starting deployment:
1. [Build: npm run build]
2. [Upload: ssh_upload dist/ → /var/www/app/]
3. [Restart: ssh_exec systemctl restart app]
4. [Health check: http_get http://prod-server/health]
Deployment complete! App is running.

find_bug — Remote Troubleshooting

Example
You: The app on prod-server just crashed, find out why

AI: [Calls find_bug]
Checking app logs, system logs, memory and CPU...
Found: OOM Kill. Recommend adding --max-old-space-size parameter.

Security Notes

🔒 All NeoWeb AI data is stored 100% locally. Your SSH keys and server info never leave your device.

Multi-Server Management

Example
You: Run tests on dev-server, then deploy to prod-server if they pass

AI: Running tests on dev-server...
[ssh_exec dev-server: npm test] — All passed
Deploying to prod-server...
[ssh_deploy → prod-server] — Deployment successful