配置
所有配置统一在项目根目录的 settings.yaml 中管理。
数据库
Tip
macOS Homebrew 安装的 PostgreSQL 用户名通常是你的系统用户名(终端执行 whoami 查看);Linux/Windows 安装通常是 postgres。
语言
LLM 配置
Tip
openai 配置支持所有 OpenAI 兼容接口:OpenAI / DeepSeek / Groq / 本地 vLLM 等。只需修改 api_base 和 api_key。
云端 LLM(兜底 + 网页搜索)
本地模型回答质量不足时自动升级到云端。即使用本地模型也建议配置:
cloud_llm:
enabled: true
providers:
- name: "openai"
model: "gpt-4o"
api_base: "https://api.openai.com"
api_key: "sk-your-openai-api-key"
search: true # 启用网页搜索能力
priority: 1
- name: "deepseek"
model: "deepseek-chat"
api_base: "https://api.deepseek.com"
api_key: "sk-your-deepseek-key"
priority: 2
escalation:
auto: true # 自动升级
feedback: true # 升级后告知用户
min_response_length: 20 # 回复少于此字数视为低质量
failure_keywords: # 包含这些关键词视为失败
- "我不确定"
- "我无法"
Telegram Bot
- 在 Telegram 找 @BotFather,发
/newbot创建 Bot,获取 Token - 获取你的 user ID(二选一):
- 给 @userinfobot 发任意消息,它会回复你的 ID
- 或给 Bot 发一条消息,然后访问
https://api.telegram.org/bot<TOKEN>/getUpdates查看
- 填入配置:
telegram:
bot_token: "123456:ABC-DEF..."
temp_dir: "tmp/telegram"
allowed_user_ids: [your_user_id] # 只允许你自己使用
Discord Bot(可选)
- 前往 Discord Developer Portal 创建应用
- 在 Bot 页面获取 Token,开启 Message Content Intent
- 用 OAuth2 URL 邀请 Bot 到你的服务器
向量嵌入(可选,默认关闭)
启用后可按语义搜索记忆(而非关键词匹配)。需要 Ollama 运行 bge-m3 模型:
时区
用于静默时段和主动推送的时间判断。
数据库(高级)
database:
name: "Riverse"
user: "your_username"
host: "localhost"
password: "" # 如果 PostgreSQL 需要密码
port: 5432 # 默认 PostgreSQL 端口
会话记忆
控制 AI 在单次对话中的上下文管理:
session_memory:
char_budget: 3000 # 上下文总字符预算
keep_recent: 5 # 保留完整的最近轮次数
summary_ratio: 0.4 # 摘要占预算的比例
recall_max: 3 # 向量召回最大条数
recall_min_score: 0.45 # 召回最低相似度
详见 记忆与 Sleep。
工具
tools:
enabled: true
voice_transcribe:
model: "whisper-1"
language: "zh" # 语音语言
image_describe:
provider: "openai" # "openai" 或 "local"(Ollama LLaVA)
model: "gpt-4o"
file_read:
enabled: true
max_file_size: 1048576 # 最大 1MB
allowed_dirs: [] # 空=不限目录
shell_exec:
enabled: false # 安全考虑默认禁用
timeout: 30
whitelist:
- "ls"
- "date"
- "git status"
web_search: # 自动使用 cloud_llm 中 search=true 的模型
语音合成(TTS)
tts:
enabled: false
voices:
zh: "zh-CN-XiaoxiaoNeural"
en: "en-US-AriaNeural"
temp_dir: "tmp/tts"
max_chars: 500 # 超过此长度截断
向量嵌入(高级)
embedding:
enabled: true
model: "bge-m3"
api_base: "http://localhost:11434"
search:
top_k: 5 # 返回最相关的条数
min_score: 0.40 # 最低相似度
clustering:
enabled: false # KMeans 聚类
show_themes: false # 在上下文中显示聚类主题
MCP 协议
主动推送
proactive:
enabled: true
scan_interval_minutes: 30
quiet_hours:
start: "23:00"
end: "08:00"
max_messages_per_day: 3
min_gap_minutes: 120
triggers:
event_followup:
enabled: true
min_importance: 0.6
followup_after_hours: 24
max_age_days: 7
strategy:
enabled: true
idle_checkin:
enabled: true
idle_hours: 48