zixin947/dsh-compact ↗★ 0

dsh-compact

DeepSeek Harness 上下文自动压缩、手动压缩与溢出恢复插件 核心用途是在上下文接近模型窗口上限或发生溢出时,自动或手动对历史上下文进行压缩和裁剪。适合进行超长对话、需要防止 Token 溢出的用户。

套件
dsh-compact
相容性
待驗證
Harness 依賴範圍
^0.1.0-rc.7
Cordis 依賴範圍
^4.0.1
版本
1.0.0
授權
MIT
最近更新
2026年8月21日

同名套件的其他儲存庫

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:zixin947/dsh-compact

默认配置

配置项默认值说明
enabledtrue是否启用自动压缩和溢出恢复
thresholdRatio0.75上下文达到模型窗口的 75% 时触发自动压缩
retainRatio0.20压缩后保留最近约 20% 的上下文
recoverOnOverflowtrue上下文溢出时是否尝试压缩恢复
maxOverflowRetries1原请求发生溢出后允许的最大恢复重试次数
modelPolicies[]按 provider 和 model 精确覆盖默认策略

示例:

- id: compact
  name: 'dsh-compact'
  config:
    enabled: true
    thresholdRatio: 0.75
    retainRatio: 0.20
    recoverOnOverflow: true
    maxOverflowRetries: 1
    modelPolicies:
      - provider: youchu
        model: deepseek-v4-flash
        thresholdRatio: 0.80
        retainRatio: 0.20

约束:

  • thresholdRatio 允许范围为 0.50 到 0.95。
  • retainRatio 允许范围为 0.05 到 0.50。
  • retainRatio 必须小于对应的 thresholdRatio。
  • 模型策略使用 provider + model 精确匹配。