DDDFXYqiming/dsh-ocr1-memory ↗★ 2
@dsh-external/dsh-ocr1-memory
基于 DeepSeek-OCR1 光学压缩记忆系统:把记忆渲染为图像存储,支持 SoM 分段、年龄衰减/模糊化、激活召回、DSH Agent 检索 将记忆渲染为图像并支持衰减与检索。适合需要视觉辅助记忆的用户。
インストール
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:DDDFXYqiming/dsh-ocr1-memoryドキュメント
README 全文を読む ↗配置
在 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。