配置

本页介绍如何通过配置选项自定义 InnoClaw 的行为。

基于环境变量的配置

所有配置都通过 .env.local 文件中的环境变量完成。请参阅环境变量获取完整参考。

AI 提供商设置

选择提供商

InnoClaw 支持多个 AI 提供商。通过设置相应的 API 密钥来配置您偏好的提供商:

# Use OpenAI
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx

# Use Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxx

# Use Google Gemini
GEMINI_API_KEY=your-gemini-key

# Or configure multiple and switch in the Settings UI

Default Provider and Model

Set the default LLM provider and model used when the application starts:

LLM_PROVIDER=openai       # openai, anthropic, or gemini
LLM_MODEL=gpt-4o-mini     # Any model ID from the selected provider

These defaults can be overridden at any time via the Settings UI.

使用自定义端点

用于第三方兼容服务、代理或自托管模型:

# Custom OpenAI-compatible endpoint
OPENAI_BASE_URL=https://api.your-provider.com/v1

# Custom Anthropic endpoint
ANTHROPIC_BASE_URL=https://api.your-provider.com

# Custom Gemini-compatible endpoint (OpenAI-compatible proxy)
GEMINI_BASE_URL=https://api.your-provider.com

独立的 Embedding 配置

如果您的对话模型提供商不支持 Embedding 端点,请配置单独的服务:

EMBEDDING_API_KEY=sk-your-embedding-key
EMBEDDING_BASE_URL=https://api.your-embedding-provider.com/v1
EMBEDDING_MODEL=text-embedding-3-small

Agent Configuration

Max Tool Steps

Control how many tool-call steps the agent can take per request:

AGENT_MAX_STEPS=10    # Default: 10, range: 1-100

Higher values allow more complex multi-step tasks but consume more tokens.

应用内设置

访问 /settings 设置页面以:

  • Switch AI Provider — Toggle between OpenAI, Anthropic, and Gemini

  • 选择模型 —— 选择用于对话的特定模型

  • 查看 API 状态 —— 检查已配置的 API 密钥

  • 查看工作空间根目录 —— 查看已配置的工作空间根目录

  • Configure HuggingFace Token — Set HF_TOKEN for dataset downloads

工作空间配置

根目录

WORKSPACE_ROOTS 变量控制用户可以在哪些服务器目录中创建工作空间:

# Single root
WORKSPACE_ROOTS=/data/workspaces

# Multiple roots (comma-separated)
WORKSPACE_ROOTS=/data/research,/data/projects,/home/user/documents

重要

  • 所有指定的目录必须已在服务器上存在

  • 用户只能在这些根目录内创建工作空间

  • 安全检查会阻止路径遍历到这些根目录之外

数据库配置

InnoClaw uses SQLite with the database stored at ./data/innoclaw.db by default. You can override this path via the DATABASE_URL environment variable:

# Plain filesystem path (no SQLite URI scheme)
DATABASE_URL=/tmp/innoclaw/innoclaw.db

备注

Only plain filesystem paths are accepted (e.g. /data/innoclaw.db). SQLite connection strings like file:./data/innoclaw.db?mode=rwc are not supported — the file: prefix will be stripped automatically.

要使用全新数据库:

# Remove existing database
rm ./data/innoclaw.db

# Re-run migrations
npx drizzle-kit migrate

Build Configuration

If the project resides on a network filesystem (NFS, CIFS, etc.), the Next.js build cache may fail. Set a local build directory:

NEXT_BUILD_DIR=/tmp/innoclaw-next

Proxy Configuration

For environments that require an HTTP proxy to reach external APIs:

HTTP_PROXY=http://your-proxy:3128
HTTPS_PROXY=http://your-proxy:3128
NO_PROXY=localhost,127.0.0.1,10.0.0.0/8

All outbound fetch() calls (AI API, GitHub, HuggingFace, etc.) will go through the proxy. Hosts listed in NO_PROXY bypass it.

机器人集成配置

请参阅通知了解飞书和企业微信机器人集成的配置。