Skip to content

[MN4][P0] Add connection diagnostics and export preview #2

Description

@evan188199-tech

Tracked by #10. Local plan: docs/roadmap/marginnote-4.md.

Goal (中文): 连接前先检查 MN4 导出目录:展示兼容状态、文件/高亮/笔记/脑图统计和解析警告;只有确认可解析后才允许连接。

Do you need to file a feature request?

  • I have searched the existing feature requests and this feature request is not already filed.
  • I believe this is a legitimate feature request, not just a question or bug.

Feature Request Description

Add a connection-time probe so users can validate a MarginNote 4 export folder before it becomes a Connected KB.

Today POST /api/v1/knowledge/connect-marginnote registers a pointer with little validation, and CreateKbModal does not probe MN4 folders the way linked RAG folders or LightRAG servers are probed.

Add POST /api/v1/knowledge/probe-marginnote that:

  • does not register a KB
  • does not write into the export folder
  • still goes through the existing path access policy
  • returns compatibility status, file counts, document/highlight/note/mind-map counts, parse warnings, and writeback-directory availability

The Create KB modal should gain a Check folder action, loading/error/empty states, and a stats preview. Connect stays disabled until the probe finds parsable content.

Related Module

Knowledge Base Management

Use Case

A user pastes an export path, clicks Check folder, and immediately sees whether DeepTutor can read the notebook. An empty, damaged, or inaccessible folder fails before a dead KB is created.

Additional Context

Priority: P0
Phase: M1
Status: Planned
Depends on: parser hardening
Blocks: dedicated notebook detail experience

Key files

  • deeptutor/api/routers/knowledge.py
  • deeptutor/capabilities/marginnote/data/base.py
  • web/lib/knowledge-api.ts
  • web/components/knowledge/CreateKbModal.tsx
  • web/locales/en/app.json
  • web/locales/zh/app.json

Acceptance criteria

  • POST /api/v1/knowledge/probe-marginnote returns compatibility, counts, warnings, and writeback availability without registering a KB or writing files.
  • Path access policy is enforced; forbidden or remote-inaccessible local paths fail clearly.
  • Create KB modal has Check folder, loading, error, empty, and stats-preview states.
  • Connect is enabled only after the probe finds parsable content.
  • Empty folder, corrupted files, permission errors, and no-content folders are recoverable UI states.

Success metric
Users can reject a bad export before connecting and only create KBs that DeepTutor can actually read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions