dsh-auto-continue
Automatically resumes replies that get cut off at the output token limit — built for self-hosted Ollama users. · 回答被输出上限截断时自动续写——为自部署 Ollama 用户打造。
When a model hits the per-request output token cap (max-tokens), DeepSeek Harness ends the turn and shows "Send 'continue' to let the model resume". This plugin watches for exactly that event and sends the continuation automatically — no manual typing, no babysitting long answers.
当模型达到单次请求的输出 token 上限(max-tokens)时,DeepSeek Harness 会结束这一轮并提示"发送'继续'可让模型接着输出"。本插件监听该事件并自动发送续写指令——不用手动打字,不用守着长回答。
🦙 Who is this for? Self-hosted Ollama deployments. Local models on consumer hardware usually run with a deliberately small output cap (4K–8K) to keep the GPU/CPU stable — so long answers get truncated constantly. This plugin is the band-aid that makes truncation painless without raising the cap. It works with any provider, but it is designed for Ollama.
🦙 这个插件是给谁的? 自部署 Ollama 的用户。本地模型跑在消费级硬件上,通常刻意把输出上限设得很小(4K–8K)以保证硬件稳定——于是长回答频繁被截断。本插件就是让截断不再痛苦的"创可贴",不需要调高上限。任何 provider 都能用,但它是为 Ollama 设计的。
Features / 功能
- 🔁 Automatic continuation — on a
max-tokensturn end, queues a "继续" prompt viaagent.followup(); the model resumes in a new turn. / 检测到max-tokens截断自动队列"继续",模型在新一轮接着输出。 - 🛡️ Loop protection — at most
maxAutoContinuesconsecutive auto-continues per session (default 5); any normally-finished turn resets the counter. / 同一会话连续截断最多自动继续 5 次(默认),防死循环;正常结束的轮次自动重置计数。 - 🙅 Never fights your input — skips when you already have queued messages. / 你已有排队消息时自动跳过,不与手动输入打架。
- 📝 Audit log — every auto-continue is recorded. / 每次自动继续都有日志可查。
Install / 安装
dsh plugin --profile web add github:zhou1736948757-cpu/dsh-auto-continue
Or browse it in the dsh-market plugin market inside Settings. / 或在设置里的 dsh-market 插件市场中浏览安装。
How it works / 工作原理
- Listens to each agent session's
session/eventfeed forturn/endwithreason.kind === "max-tokens". - Queues a user message (default text
继续, taggedsource.kind = "auto-continue") throughagent.followup()after a short delay so the turn fully settles. - The truncated output stays in the conversation, so the model continues from where it stopped — exactly like typing "继续" yourself, but automatic.
Configuration / 配置
Add to settings.yaml (or accept the defaults): / 在 settings.yaml 中添加(或直接用默认值):
dsh-auto-continue:
maxAutoContinues: 5 # max consecutive auto-continues per session (1-20) / 连续截断最多自动继续次数
continueText: 继续 # the continuation prompt text / 续写指令文本
delayMs: 300 # delay before sending, lets turn/end settle (ms) / 发送前延迟
logFile: '' # log path, default $DSH_HOME/super-injector/dsh-auto-continue.log / 日志路径
Log / 日志
Every auto-continue is appended to $DSH_HOME/super-injector/dsh-auto-continue.log (default). If a reply stops without resuming, the log says whether it hit the cap or failed. / 每次自动继续都会写入 $DSH_HOME/super-injector/dsh-auto-continue.log(默认路径)。如果某次回答没续上,看日志就知道是"达到上限停止"还是"发送失败"。
Notes / 说明
- This is a safety net, not a fix for the root cause. If your hardware allows a larger cap, raising the model's
maxTokens(Settings → Models) and/or loweringreasoningEffortreduces truncation itself. / 这是兜底方案,不是治本。如果硬件允许,调大模型maxTokens(设置 → 模型)或降低reasoningEffort能减少截断本身。 - With
reasoningEffort: max, a truncation may happen with zero visible text (reasoning consumed the budget). The plugin still continues — the model keeps reasoning until it produces output. / 推理强度为 max 时,截断可能发生在正文出现之前(额度被思考耗尽)。插件照常续写,模型会继续思考直到出正文。 - Each continuation is an ordinary new request — no extra load on your hardware beyond what a manual "继续" would cause. / 每次续写就是一次普通请求,对硬件的压力与你手动发"继续"完全一样。
License / 许可证
BSD-3-Clause
No comments yet. Be the first to write one.