mafeis/dsh-image-guard0

dsh-image-guard

DeepSeek Harness plugin: trims the oldest images from outgoing chat requests and, when the provider rejects the image count with HTTP 400, parses the limit from the error and retries with fewer images. · DSH 插件:裁剪即将发出请求中的历史图片,并在上游因图片数量返回 400 时解析该上限并按更少的图片重试。

包名
dsh-image-guard
版本
0.8.16
许可证
MIT
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:mafeis/dsh-image-guard

配置

~/.dsh/image-guard.json,修改后热更新、无需重启;也可在设置页或通过 /_dsh/image-guard 路由修改。

字段默认值说明
enabledtrue总开关;关闭后完全透传
keepRecent12保留最新的图片张数,其余替换为标记(0 表示全部)
maxRetries3400 后的降级重试次数
learnLimittrue是否从 400 响应中解析上游上限
dryRunfalse仅观察,不修改任何请求
matchPath/chat/completions|/messages处理的路径(正则)
markerLang空(跟随界面语言)标记语言:留空跟随宿主界面语言,zh / en 为固定值;决定默认模板与标记正文(身份、取回提示)的语言
placeholder标记模板;留空或等于某语言默认模板 = 用生效语言的默认模板(zh[图片已省略 #{index}{identity}{hint}]en[image omitted #{index}{identity}{hint}]
pathModebasenamefull / relative / basename / none
tokensPerImage972估算节省量所用的单张图片视觉 token 数(0 表示不估算)
verbosetrue是否输出日志

插件在本机只读三处文件:配置 ~/.dsh/image-guard.json、状态 ~/.dsh/image-guard-status.json,以及宿主 ~/.dsh/settings.yaml 中的 locale.preference用于决定默认标记语言,读不到即按中文)。除此之外不发起任何外发请求,凭据不读取、不上报。