102 lines
3.5 KiB
Markdown
102 lines
3.5 KiB
Markdown
# PicoBot 配置说明
|
||
|
||
配置文件加载顺序:`~/.picobot/config.json` → 当前目录 `./config.json`。
|
||
占位符 `<VAR_NAME>` 从环境变量替换,环境变量从 `.env` 文件或系统环境读取。
|
||
|
||
## config.json 结构
|
||
|
||
```jsonc
|
||
{
|
||
"providers": {}, // LLM 提供商配置
|
||
"models": {}, // 模型配置
|
||
"agents": {}, // agent 配置
|
||
"gateway": {}, // 网关配置
|
||
"client": {}, // 客户端配置
|
||
"channels": {}, // 渠道配置
|
||
"memory": {}, // 记忆系统配置
|
||
"workspace_dir": // 工作目录,默认 ~/.picobot/workspace
|
||
"mcp": {} // MCP 服务器配置
|
||
}
|
||
```
|
||
|
||
完整示例见 `assets/config.example.json`。
|
||
|
||
## providers 字段
|
||
|
||
| 字段 | 说明 |
|
||
|------|------|
|
||
| `type` | 提供商类型: `openai`(兼容 OpenAI API)、`anthropic` |
|
||
| `base_url` | API 端点地址 |
|
||
| `api_key` | API 密钥,支持 `<ENV_VAR>` 占位符 |
|
||
| `extra_headers` | 额外 HTTP 头 |
|
||
|
||
## models 字段
|
||
|
||
| 字段 | 说明 |
|
||
|------|------|
|
||
| `model_id` | 模型标识名称 |
|
||
| `temperature` | 采样温度,可选 |
|
||
| `max_tokens` | 最大输出 token 数,可选 |
|
||
| `input_type` | 模型支持的输入类型,如 `["text"]` 或 `["text", "image"]`,默认 `["text"]`. 纯内部使用,不会传递给 LLM API |
|
||
|
||
## agents 字段
|
||
|
||
| 字段 | 类型 | 默认 | 说明 |
|
||
|------|------|------|------|
|
||
| `provider` | string | - | 提供商名称(对应 providers key) |
|
||
| `model` | string | - | 模型名称(对应 models key) |
|
||
| `max_tool_iterations` | int | 99 | 最大工具调用轮数 |
|
||
| `token_limit` | int | 128000 | 上下文 token 限制 |
|
||
|
||
## gateway 字段
|
||
|
||
| 字段 | 类型 | 默认 | 说明 |
|
||
|------|------|------|------|
|
||
| `host` | string | 127.0.0.1 | 监听地址 |
|
||
| `port` | int | 19876 | 监听端口 |
|
||
| `session_ttl_hours` | int | - | 会话过期小时数 |
|
||
| `session_db_path` | string | - | SQLite 数据库路径,默认在 workspace 下 |
|
||
| `cleanup_interval_minutes` | int | - | 清理间隔 |
|
||
| `scheduler` | object | - | 调度器配置 |
|
||
|
||
## memory 字段
|
||
|
||
| 字段 | 类型 | 默认 | 说明 |
|
||
|------|------|------|------|
|
||
| `consolidation_provider` | string | - | 记忆归并 LLM 提供商 |
|
||
| `consolidation_model` | string | - | 记忆归并 LLM 模型 |
|
||
| `recall_limit` | int | 5 | 每轮注入的知识记忆条数 |
|
||
| `idle_consolidation_minutes` | int | 10 | 空闲后触发归并的分钟数 |
|
||
| `timeline_retention_days` | int | 90 | 时间线记忆保留天数 |
|
||
| `max_failures_before_degrade` | int | 3 | 归并失败次数阈值 |
|
||
|
||
## channels.feishu 字段
|
||
|
||
| 字段 | 类型 | 默认 | 说明 |
|
||
|------|------|------|------|
|
||
| `enabled` | bool | false | 是否启用 |
|
||
| `app_id` | string | - | 飞书应用 ID |
|
||
| `app_secret` | string | - | 飞书应用密钥 |
|
||
| `allow_from` | []string | ["*"] | 允许交互的用户列表 |
|
||
| `agent` | string | - | 使用的 agent 名称 |
|
||
| `media_dir` | string | ~/.picobot/media/feishu | 媒体存储目录 |
|
||
| `reaction_emoji` | string | "Typing" | 回复意向表达的表情 |
|
||
|
||
## mcp 字段
|
||
|
||
| 字段 | 类型 | 默认 | 说明 |
|
||
|------|------|------|------|
|
||
| `servers` | array | [] | MCP 服务器列表 |
|
||
| `tool_timeout_secs` | int | 180 | 工具调用超时秒数 |
|
||
|
||
MCP 服务器单条配置:
|
||
|
||
| 字段 | 说明 |
|
||
|------|------|
|
||
| `name` | 服务器名称 |
|
||
| `transport` | 传输方式: `Stdio`、`Sse`、`streamable-http` |
|
||
| `command` | 启动命令(Stdio 模式) |
|
||
| `args` | 命令参数 |
|
||
| `url` | URL(Sse / streamable-http 模式) |
|
||
| `tool_timeout_secs` | 单独的超时设置 |
|