DDDFXYqiming/dsh-ocr1-memory ↗★ 2

@dsh-external/dsh-ocr1-memory

基于OCR的光学压缩记忆与图像检索系统。 将记忆渲染为图像并支持衰减与检索。适合需要视觉辅助记忆的用户。

包名
@dsh-external/dsh-ocr1-memory
兼容性
待验证
Harness 依赖范围
>=0.1.0-rc <2
Cordis 依赖范围
>=4.0.0-rc <5
版本
0.1.0
许可证
BSD-3-Clause
最近更新
2026年9月16日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:DDDFXYqiming/dsh-ocr1-memory

配置

在 profile 的 cordis.patch.yml 里覆盖需要的选项。

- id: dsh-ocr1-memory
  config:
    storeDir: ''
    memoryDir: '~/.dsh/memory'
    maxIndexLines: 30
    autoNamespace: true
    autoPending: true
    maintainEveryTurns: 20
    maintenanceBatchSize: 8 # 每次维护最多处理的光学条目数
    reflectPendingThreshold: 5
    reflectSopsThreshold: 40

    # OCR / llama-server
    ocrBaseUrl: ''
    ocrApiKey: ''
    ocrModel: 'deepseek-ai/DeepSeek-OCR'
    requireOcr: false # true = OCR 不可用时失败,不静默走文本降级
    autoStartOcrServer: false
    ocrServerPath: '' # 也可使用 OCR_SERVER_PATH 或 PATH 中的 llama-server
    ocrModelDir: ''
    ocrServerPort: 18080

    # Optical locator
    opticalLocatorEnabled: false
    opticalLocatorBaseUrl: ''
    opticalLocatorModel: 'deepseek-ocr-memory'
    opticalLocatorThreshold: 0.4
    opticalLocatorTopK: 5
    opticalLocatorStrict: true
    opticalLocatorAutoStart: false
    opticalLocatorServerPath: ''
    opticalLocatorModelDir: ''
    opticalLocatorServerPort: 18081
    opticalLocatorModelFile: 'deepseek-ocr-locator-q8_0.gguf'
    opticalLocatorMmprojFile: 'mmproj-locator-q8_0.gguf'

    # Context / retrieval
    dynamicDecayEnabled: false
    autoInjectContext: true
    contextMode: 'index' # snapshot 可保留正文快照
    contextMaxEntries: 5
    contextMaxChars: 4000
    sharedStore: false
    embeddingRetrieval: false
    ocrMaxEntriesPerRetrieve: 5

想让插件自己管一个真实的 CPU llama-server,把 autoStartOcrServer 设为 true,同时提供 ocrServerPath 和 ocrModelDir。ocrBaseUrl 里写了显式端口的话,健康检查和启动都以它为准。Embedding 默认不参与主检索,复用同一个服务时把 ocrEmbeddingBaseUrl 留空即可。训练后的 Locator 可以通过 opticalLocatorAutoStart 在独立 endpoint 自动启动,模型目录也可以交给 OPTICAL_LOCATOR_MODEL_DIR 提供。

环境变量回退(仅在对应 Config 字段留空时生效,Config 永远优先;面向源码直跑/脚本场景,profile 部署建议全部走 cordis.yml):OCR_SERVER_PATH(ocr/embedding/locator 的 serverPath 默认)、OCR_MODEL_DIR / OCR_EMBEDDING_MODEL_DIR(模型目录)、OPTICAL_LOCATOR_MODEL_DIR(locator 模型目录)、PYTHON(渲染器直调时的 python 可执行文件)。

高级选项见 docs/IMPLEMENTATION.md。