如何大幅缩减小龙虾(openclaw)调用大模型的tokens流量




sudo apt updatesudo apt install git #如果git已经安装了,这一步就不需要了git clone https://github.com/tobi/qmd.git
#### 1. 获取源码(已经获取了,不用再执行)```bash# 克隆仓库git clone https://github.com/tobi/qmd.gitcd qmd# 或者使用当前目录(如果已经在项目目录中)cd /data/home/你的用户名/gitProjects/qmd```#### 2. 安装依赖```bash# 使用npm安装依赖npm install# 或使用bun安装依赖(更快)bun install```#### 3. 构建项目```bash# 使用npm构建npm run build# 或使用bun构建bun run build```#### 4. 链接到全局(可选)```bash# 使用npm链接到全局npm link# 或使用bun链接到全局bun link```#### 5. 配置环境变量```bash# 设置缓存目录(可选)export XDG_CACHE_HOME=/path/to/cache #~/.cache/qmd# 设置自定义嵌入模型(可选)export QMD_EMBED_MODEL="hf:Qwen/Qwen3-Embedding-0.6B-GGUF/Qwen3-Embedding-0.6B-Q8_0.gguf"# 设置配置目录(可选)export QMD_CONFIG_DIR=/path/to/config #/data/home/songxiangbo/.config/qmd or #~/.config/qmd```#### 6. 初始化数据库和索引```bash# 创建配置文件mkdir -p ~/.config/qmdcp example-index.yml ~/.config/qmd/index.yml# 添加集合qmd collection add ~/Documents/notes --name notesqmd collection add ~/Documents/docs --name docs# 生成向量嵌入qmd embed# 测试搜索qmd search "test query"
"memory": {"backend": "qmd","qmd": {"limits": {"timeoutMs": 8000}}}

用这种方法,不仅仅tokens流量大幅缩减(减少90%),小龙虾反应也会更快,反馈的也会更为准确。
夜雨聆风