@xiaoqiong0v0/opencode-file-tool
v1.0.8
Published
File cache & image analysis plugin for OpenCode. Auto-caches pasted images, analyzes via multimodal model.
Readme
opencode-file-tool
OpenCode 文件缓存与图片分析插件。自动缓存用户粘贴的图片,通过多模态模型分析,绕过主模型不支持视觉的限制。
安装
在 opencode.json 的 plugin 数组添加包名:
"plugin": ["@xiaoqiong0v0/opencode-file-tool"]重启 OpenCode 后自动安装。首次使用 file_tool set-provider <模型名> 配置视觉模型。
功能
- 文件缓存 — 粘贴图片时自动缓存到
~/.opencode/plugins-cache/file-tool/ - 图片分析 — 通过
analyze_image file_id:N调用视觉模型分析 - 会话父子链 — 子 agent 会话可通过 parent 链回退读取祖先会话的缓存
- 开关控制 — 主模型支持视觉时可用
disable关闭缓存,让模型直接读取图片 - 多语言 — 支持中/英文提示
工具
| 工具 | 说明 |
|------|------|
| file_tool list-provider | 列出可用模型 |
| file_tool set-provider <model> | 切换视觉模型 |
| file_tool list-cache [all\|N\|main\|main N] | 查看缓存文件 |
| file_tool enable | 临时开启图片缓存(重启恢复默认) |
| file_tool disable | 临时关闭图片缓存(重启恢复默认) |
| file_tool enable-save | 持久开启图片缓存(写入配置) |
| file_tool disable-save | 持久关闭图片缓存(写入配置) |
| file_tool status | 查看缓存开关状态和当前视觉模型 |
| analyze_image file_id:N | 分析指定图片 |
命令
| 命令 | 说明 |
|------|------|
| /file-tool | 触发 file_tool 工具 |
配置
~/.config/opencode/file-tool.jsonc 在首次启动时自动生成,支持 enabled 字段控制缓存开关。
GitHub
https://github.com/xiaoqiong0v0/opencode-file-tool
