How duoleshi/0606-klb works
This is a Next.js application for AI-assisted review of high-risk construction plans. The main workflow uploads a PDF, extracts text (using OCR when needed), identifies relevant engineering specialties, matches standards from the knowledge base, generates a structured AI review, and saves the result for later retrieval. Separate features expose review history, standards documents, authentication, and OCR testing. The principal processing calls are visible in the review and PDF-parser excerpts; some page-to-API connections are documented or implied but not shown in the sampled code.
Main entry points: route.ts Review orchestrator · pdf-parser.ts PDF extraction · hero.tsx Review workspace · db.ts Review records
Components 23
User experience
- Review workspace
components/landing/hero.tsx - File selection
components/file-upload.tsx - Report editor
components/review-result.tsx - History views
app/history/page.tsx - Standards browser
app/regulations/page.tsx
Review processing
- Review orchestrator
app/api/review/route.ts - PDF extraction
lib/pdf-parser.ts - Specialty matching
lib/knowledge-base.ts - Knowledge context
lib/knowledge-base.ts - OCR test endpoint
app/api/ocr-test/route.ts
Records and standards
- History endpoints
app/api/history/route.ts - Record endpoint
app/api/history/[id]/route.ts - Review records
lib/db.ts - Standards endpoint
app/api/regulations/route.ts
Identity and integrations
- AI review service
- MinerU OCR
- Baidu OCR
- Tesseract OCR
- Sign-in and registration
app/login/page.tsx - Registration endpoint
app/api/auth/register/route.ts - Supabase identity
lib/supabase/server.ts
Other components
- Plan reviewer
- Web browser
Connections 24
- Plan reviewer → Review workspace: uploads plan
README.md - Review workspace → File selection: selects file
components/landing/hero.tsx - Review workspace → Review orchestrator: submits for review
- Review orchestrator → PDF extraction: parses document
app/api/review/route.ts - Review orchestrator → Specialty matching: matches knowledge
app/api/review/route.ts - Specialty matching → Knowledge context: returns context
app/api/review/route.ts - Review orchestrator → AI review service: requests analysis
- PDF extraction → MinerU OCR: uses OCR
lib/pdf-parser.ts - PDF extraction → Baidu OCR: uses OCR
lib/pdf-parser.ts - PDF extraction → Tesseract OCR: uses OCR
lib/pdf-parser.ts - Review orchestrator → Review records: saves result
app/api/review/route.ts - Review orchestrator → Supabase identity: gets user ID
app/api/review/route.ts - Review workspace → Report editor: shows result
components/landing/hero.tsx - Plan reviewer → History views: views history
README.md - History views → History endpoints: loads records
- History endpoints → Review records: reads records
app/api/history/route.ts - Record endpoint → Review records: reads or deletes
app/api/history/[id]/route.ts - Plan reviewer → Standards browser: browses standards
README.md - Standards browser → Standards endpoint: loads documents
- Plan reviewer → Sign-in and registration: signs in
- Sign-in and registration → Supabase identity: authenticates
- Registration endpoint → Supabase identity: registers user
- Web browser → OCR test endpoint: tests OCR
- OCR test endpoint → PDF extraction: parses upload
app/api/ocr-test/route.ts