Files
smy-skills/mengya-rag-skill/references/output-schema.md
2026-06-12 17:48:53 +08:00

1.8 KiB
Raw Blame History

mengya-rag JSON 输出格式参考

所有命令加 --json 后输出 JSON供 Agent 程序化解析。

status

{
  "ok": true,
  "command": "status",
  "project_root": "...",
  "notes_dir": "...",
  "index_dir": "...",
  "db_exists": true,
  "nodes_file_exists": true,
  "deepseek_api_key_configured": true,
  "deepseek_model": "deepseek-v4-flash",
  "markdown_note_count": 495,
  "index_node_count": 1802
}
{
  "ok": true,
  "command": "search",
  "question": "用户问题",
  "mode": "hybrid",
  "top_k": 2,
  "results": [
    {
      "source": "Docker/Docker常用命令总结.md",
      "title": "Docker常用命令总结",
      "heading_path": "容器生命周期管理",
      "chunk_index": 0,
      "score": 0.85,
      "raw_score": 0.75,
      "metadata": { "h1": "Docker常用命令总结", "h2": "容器生命周期管理" },
      "content": "## 容器操作\n```bash\ndocker run ...\n```"
    }
  ]
}

context

{
  "ok": true,
  "command": "context",
  "question": "用户问题",
  "mode": "hybrid",
  "top_k": 2,
  "context": "[1] 来源: ...\n文件: Docker/xxx.md\n标题: XXX\n标题路径: ...\n\n---\n笔记内容...\n\n[2] 来源: ...\n...",
  "sources": ["Docker/xxx.md", "Docker/yyy.md"]
}

read

{
  "ok": true,
  "command": "read",
  "source": "Docker/Docker常用命令总结.md",
  "content": "## 完整 Markdown 原文内容..."
}

ask

{
  "ok": true,
  "command": "ask",
  "question": "用户问题",
  "mode": "hybrid",
  "top_k": 4,
  "answer": "DeepSeek 生成的回答文本...",
  "sources": ["文件1.md", "文件2.md"]
}

reindex

{
  "ok": true,
  "command": "reindex",
  "synced_notes": 495,
  "indexed_nodes": 1802,
  "duration_seconds": 12.5
}

错误返回

{
  "ok": false,
  "error": "错误描述信息"
}