Sign inSign up

codeyhj/nanobot

By codeyhj

•Updated 3 months ago

Image
0

5.3K

codeyhj/nanobot repository overview

⁠nanobot Docker 镜像

🤖 基于 nanobot⁠ 的轻量级 AI 助手容器镜像

⁠快速开始

# 拉取镜像
docker pull codeyhj/nanobot:latest

# 创建配置目录和文件(必须配置 API Key)
mkdir -p .nanobot
cat > .nanobot/config.json << 'EOF'
{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-3-5-sonnet-20241022"
    }
  },
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-your-anthropic-key"
    }
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  }
}
EOF

# 运行容器
docker run -d \
  -v $(pwd)/.nanobot:/home/nanobot/.nanobot \
  -p 18790:18790 \
  --name nanobot \
  codeyhj/nanobot:latest

⚠️ 注意:如不配置 API Key,容器会报错 Error: No API key configured. 并退出。

⁠使用 Docker Compose

services:
  nanobot:
    image: codeyhj/nanobot:latest
    container_name: nanobot
    restart: unless-stopped
    command: ["gateway"] # 启动 gateway 保持持久运行
    ports:
      - "18790:18790"
    volumes:
      # 挂载配置目录
      - ./.nanobot:/home/nanobot/.nanobot:cached

⁠配置文件(必需)

创建 config.json,必须配置至少一个 API Key:

{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-3-5-sonnet-20241022",
      "maxTokens": 8192,
      "temperature": 0.7
    }
  },
  "providers": {
    "anthropic": {
      "apiKey": "sk-ant-your-anthropic-key"
    },
    "openai": {
      "apiKey": "sk-your-openai-key"
    },
    "deepseek": {
      "apiKey": "sk-your-deepseek-key"
    }
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  }
}

⁠挂载卷

容器内路径说明
/home/nanobot/.nanobot配置目录(含 config.json、workspace 等)

⁠支持的模型

  • anthropic/claude-3-5-sonnet-20241022 - Claude 3.5 Sonnet
  • openai/gpt-4o - GPT-4o
  • deepseek/deepseek-chat - DeepSeek V3
  • openrouter/... - 通过 OpenRouter 使用

⁠常用命令

# 查看日志
docker logs -f nanobot

# 进入容器
docker exec -it nanobot bash

# 查看状态
docker exec nanobot nanobot status

# 停止
docker stop nanobot

⁠端口

  • 18790 - Gateway API 端口

⁠镜像信息

  • 基础镜像: python:3.11-slim
  • Python 版本: 3.11+
  • 用户: nanobot (非 root)
  • 架构: linux/amd64, linux/arm64

⁠源码

https://github.com/HKUDS/nanobot⁠

Tag summary

Content type

Image

Digest

sha256:3369bd99e…

Size

209.5 MB

Last updated

3 months ago

docker pull codeyhj/nanobot