mycroft
Use mycroft to ingest EPUBs and ebooks, build a local vector index, and ask questions about a book.
Setup (once)
- - INLINECODE1
- INLINECODE2
- INLINECODE3
Common commands
- - List books: INLINECODE4
- Ingest EPUB: INLINECODE5
- Ingest with summaries: INLINECODE6
- Ingest with batch embeddings (50% cheaper): INLINECODE7
- Ingest with batch summaries + embeddings: INLINECODE8
- Resume batch ingestion: INLINECODE9
- Check ingestion status: INLINECODE10
- Show metadata: INLINECODE11
- Ask a question: INLINECODE12
- Search passages: INLINECODE13
- Delete book: INLINECODE14
- Start chat: INLINECODE15
- Ask in session: INLINECODE16
- Continue chat: INLINECODE17
Notes
- - Use
mycroft config path to find the config file location. - INLINECODE19 and
book search require embeddings and an OPENAI_API_KEY. - Chat commands require embeddings and an
OPENAI_API_KEY. - Prefer
book search and synthesize answers yourself before using book ask. - Summaries increase ingestion time and cost significantly; enable
--summary only when needed. - Use
--batch to run embeddings and summaries via the OpenAI Batch API at 50% cost; results may take up to 24 hours. When combined with --summary, summaries are batched first, then embeddings on resume. - After
--batch ingestion, use mycroft book ingest status <id> to check progress and mycroft book ingest resume <id> to complete indexing. - If a non-batch ingest is interrupted, use
mycroft book ingest resume <id> to continue from the last saved chunk. - If a batch fails,
resume automatically re-submits it. - For scripted runs, avoid interactive flags like
--manual or omit confirmations with --force.
mycroft
使用 mycroft 导入 EPUB 和电子书,构建本地向量索引,并就书籍内容提问。
初始设置(仅需一次)
- - export OPENAIAPIKEY=...
- mycroft config onboard
- mycroft config resolve
常用命令
- - 列出书籍:mycroft book list
- 导入 EPUB:mycroft book ingest /path/to/book.epub
- 带摘要导入:mycroft book ingest /path/to/book.epub --summary
- 批量嵌入导入(节省 50% 费用):mycroft book ingest /path/to/book.epub --batch
- 批量摘要+嵌入导入:mycroft book ingest /path/to/book.epub --batch --summary
- 恢复批量导入:mycroft book ingest resume
- 查看导入状态:mycroft book ingest status
- 显示元数据:mycroft book show
- 提问:mycroft book ask 主要冲突是什么?
- 搜索段落:mycroft book search 疯帽子 --top-k 5
- 删除书籍:mycroft book delete --force
- 开始对话:mycroft chat start
- 在会话中提问:mycroft chat ask 这预示着什么?
- 继续对话:mycroft chat repl
注意事项
- - 使用 mycroft config path 查找配置文件位置。
- book ask 和 book search 需要嵌入向量和 OPENAIAPIKEY。
- 对话命令需要嵌入向量和 OPENAIAPIKEY。
- 建议优先使用 book search 自行综合答案,再考虑使用 book ask。
- 摘要功能会显著增加导入时间和成本;仅在必要时启用 --summary。
- 使用 --batch 通过 OpenAI 批量 API 运行嵌入和摘要,可节省 50% 费用;结果可能需要最多 24 小时。与 --summary 结合使用时,先批量处理摘要,恢复后再处理嵌入。
- 批量导入后,使用 mycroft book ingest status 检查进度,使用 mycroft book ingest resume 完成索引。
- 如果非批量导入中断,使用 mycroft book ingest resume 从最后保存的块继续。
- 如果批量处理失败,resume 会自动重新提交。
- 对于脚本化运行,避免使用 --manual 等交互式标志,或使用 --force 跳过确认。