zqh260619/dsh-dupguard

zqh260619★ 0JavaScript最后同步: 2026-08-16

在 GitHub 打开

Real-time repetition guard for DeepSeek Harness (DSH): stops model generation the moment the same string repeats ≥10 times in the streamed output. 防复读守卫:实时检测 DSH 大模型输出中的重复内容并立即停止生成。

README 摘要

dupguard · DSH 大模型重复输出守卫 dupguard — a real-time repetition guard for DeepSeek Harness (DSH): stops model generation as soon as the same string repeats ≥ 10 times (configurable) in the streamed output. dupguard 是 DeepSeek Harness (DSH) 的实时重复输出守卫插件:当最新输出中同一字符串连续重复 10 次及以上 (可配置)时,立即停止本次生成。 触发后,已生成的内容会 正常提交为助手消息 ,本轮对话干净结束——不会报错、不会丢弃输出、不会污染会话日志。 When triggered, the already-generated text is committed as a normal assistant message and the turn ends cleanly — no errors, no lost output, no session-log pollution. 特性 / Features - 实时检测 :逐 token( text-delta )检测,复读出现即停,延迟为单个增量。 - 多种复读形态 :单字符循环、词语循环、带空格/换行分隔的复读均能识别(默认去空白后检测)。 - 真正的服务端停止 :提前关闭流迭代 → 适配器 consumer.abort() → 中断 HTTP 连接,模型在服务端停止生成。 - 安全停止 :绝不 abort() agent 步骤信号;补发协议合规的 block-end + finish(stop) ,消息正常提交。 - 零依赖 / 零配置 :纯 JavaScript,无运行时依赖;默认配置开箱即用。 - 双入口交付 :动态插件( plugin/host.js )+ npm 组合挂载( lib/index.js ),行为一致、CI 防漂移。 快速开始 / Quick Start 方式一:动态插件(无需安装,进程内生效)/ Dynamic plugin (no install) 把 plugin/host.js 的全部内容作为 code.host 提交给 cordis define ,再 cordis run 激活即可: 1. cordis define :kind 选 new ,idPrefix 例如 dupguard , code.host 填入 plugin/host.js 内容; 2. cordis run :激活返回的 packageId (首次使用 mode run )。 动态插件随 DSH 进程存在;重启后需重新 define + run。 Paste the enti…

在 GitHub 查看完整 README →
工具/开发dsh-plugindsh-pluginsrepetition-detection

分类