# 无人机-前端 **Repository Path**: xusun000/drone-front-end ## Basic Information - **Project Name**: 无人机-前端 - **Description**: 1234567890 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-04 - **Last Updated**: 2026-03-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 智能质检系统 - Drone Inspection System 基于 React + FastAPI + SQLite 的电机/无人机智能质检系统 ## 项目结构 ``` drone-front-end/ # 前端 (React + Vite) drone-inspection-backend/ # 后端 (FastAPI + SQLite) ``` ## 快速启动 ### 1. 启动后端 ```bash cd /Users/xusun/Desktop/Python/drone-inspection-backend pip install -r requirements.txt python main.py ``` 后端服务将在 http://localhost:8000 启动 API 文档: http://localhost:8000/docs ### 2. 启动前端 ```bash cd /Users/xusun/Desktop/Node/drone-front-end npm install npm run dev ``` 前端服务将在 http://localhost:3000 启动 ## 功能模块 ### 1. 数据采集与预处理 - 创建质检任务 - 上传检测图片 - 支持相机抓拍和文件上传 ### 2. AI 视觉检测与复核 - 查看待检测任务列表 - 运行 AI 缺陷检测 - 查看检测结果和边界框标记 - 人工复核(确认/打回) ### 3. 智能分析与质量闭环 - 查看待分析缺陷 - 大模型归因分析(生成诊断报告) - 提交整改反馈 - 确认闭环 ### 4. 全局统计与看板 - 今日采集总量 - AI 检出缺陷数 - 复核准确率 - 闭环完成率 - 缺陷类型分布 - 实时产能与缺陷趋势 - 任务溯源查询 ## API 接口文档 ### 任务管理 | 方法 | 路径 | 说明 | |------|------|------| | POST | `/api/tasks` | 创建新任务 | | GET | `/api/tasks` | 获取任务列表 | | GET | `/api/tasks/{id}` | 获取任务详情 | | POST | `/api/tasks/{id}/images` | 上传图片 | | POST | `/api/tasks/{id}/detect` | 执行 AI 检测 | | GET | `/api/tasks/{id}/defects` | 获取任务缺陷 | ### 缺陷管理 | 方法 | 路径 | 说明 | |------|------|------| | GET | `/api/defects` | 获取缺陷列表 | | PUT | `/api/defects/{id}/review` | 复核缺陷 | | POST | `/api/defects/{id}/analyze` | AI 大模型分析 | | POST | `/api/defects/{id}/feedback` | 提交反馈 | | PUT | `/api/defects/{id}/close` | 闭环缺陷 | ### 统计看板 | 方法 | 路径 | 说明 | |------|------|------| | GET | `/api/dashboard/stats` | 统计数据 | | GET | `/api/dashboard/defect-distribution` | 缺陷分布 | | GET | `/api/dashboard/trend` | 趋势数据 | | GET | `/api/dashboard/trace/{task_id}` | 任务溯源 | ## 技术栈 **前端** - React 19 - TypeScript - Tailwind CSS - Lucide React (图标) - Recharts (图表) **后端** - FastAPI - SQLAlchemy (ORM) - SQLite (数据库) - Python 3.9+ ## 环境变量 前端可以通过 `.env.local` 配置后端地址: ``` VITE_API_BASE_URL=http://localhost:8000 ``` 默认使用 `http://localhost:8000` ## 开发说明 ### 添加新的 API 接口 在 `src/api.ts` 中添加对应的接口函数: ```typescript export const newApi = { getSomething: () => request('/api/something'), }; ``` ### AI 检测模拟 后端使用随机算法模拟 AI 检测结果,实际项目中可替换为真实的模型调用: ```python # app/routers/tasks.py defect_types = [ ("螺丝缺失", "左侧法兰盘", 0.98), ("线束异常", "主控板下方", 0.85), ... ] ``` ### 大模型分析模拟 后端模拟大模型分析报告,实际项目中可接入 Gemini/文心一言等 API。 ## 数据存储 - **数据库**: SQLite (`db/inspection.db`) - **图片**: 本地文件系统 (`uploads/`) 数据持久化存储,重启服务后数据保留。