DDDFXYqiming/dsh-ocr1-memory1

@dsh-external/dsh-ocr1-memory

基于 DeepSeek-OCR1 光学压缩记忆系统:把记忆渲染为图像存储,支持 SoM 分段、年龄衰减/模糊化、激活召回、DSH Agent 检索

包名
@dsh-external/dsh-ocr1-memory
版本
0.1.0
许可证
BSD-3-Clause
最近更新
2026年8月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: ''                 # 默认 /.dsh/ocr1-memory
    ocrBaseUrl: ''               # DeepSeek-OCR vLLM/OpenAI 兼容端点;留空则跳过 OCR 读回
    ocrApiKey: ''
    ocrModel: 'deepseek-ai/DeepSeek-OCR'
    pythonPath: 'python'
    renderScript: '/scripts/render_memory.py'
    requireOcr: false            # true 时 OCR 不可用会直接报错
    useMockRenderer: false       # true 时跳过 Python 渲染(仅测试)
    autoStartOcrServer: false    # true 时插件加载后自动确保 llama-server 在线
    ocrServerPath: ''            # llama-server.exe 路径;留空用默认值
    ocrModelDir: ''              # DeepSeek-OCR GGUF 目录;留空用默认值
    ocrServerPort: 18080         # OCR 服务端口
    ocrEmbeddingBaseUrl: ''      # 通常与 ocrBaseUrl 相同(combined 模式);留空自动回退到 ocrBaseUrl
    ocrEmbeddingApiKey: ''
    ocrEmbeddingModel: ''        # 留空则使用 ocrModel
    ocrEmbeddingTimeoutMs: 120000
    ocrEmbeddingEmptyPromptTokens: 1  # 空文本 embedding 的 prompt_tokens 基线
    ocrEmbeddingAutoStart: false       # 仅当 embedding 使用独立服务时才需要 true
    ocrEmbeddingPort: 18084            # 独立 embedding 服务端口(combined 模式不使用)
    ocrEmbeddingUbatchSize: 2048       # 必须 >= 单图视觉 token 数(默认 512 会拒大图)
    ocrEmbeddingServerPath: ''         # embeddings 用的 llama-server.exe 路径
    ocrEmbeddingModelDir: ''           # embeddings 用的 GGUF 目录
    ocrEmbeddingOnDemand: true         # 仅当 embedding 使用独立服务时生效;combined 模式下直接复用 18080
    ocrEmbeddingIdleTimeoutMs: 300000  # embedding 服务空闲多少毫秒后自动关闭
    ocrEmbeddingContextSize: 2048      # embedding 服务上下文(不需要长生成,2048 够用)
    sharedStore: false                 # true 时每次操作前重读 memories.json,支持多 Agent 共享同一 store
    embeddingRetrieval: true           # true 时使用 1280 维视觉 embedding 相似度作为检索主信号(配合 ocrEmbeddingBaseUrl)
    ocrMaxEntriesPerRetrieve: 5        # 文本检索不足 topK 时,最多对多少条记忆做 OCR 读回(防止大库检索卡死)

方式一:使用 start-ocr-server.ps1(已默认启用 combined 模式)

powershell -File scripts/start-ocr-server.ps1 -Port 18080