# lib-api **Repository Path**: boo2/lib-api ## Basic Information - **Project Name**: lib-api - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-21 - **Last Updated**: 2025-10-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # InfoFlow AI MCP 项目 一个基于Flask和Vue3的智能警情报告管理系统。 ## 项目结构 ``` ai_mcp/ ├── main.py # Flask后端主应用 ├── requirements.txt # Python依赖文件 ├── services/ # 业务服务层 │ ├── intelligent_report_service.py │ ├── report_core_service.py │ ├── report_management_service.py │ └── lightweight_search_service.py ├── frontend/ # Vue3前端项目 │ ├── src/ # 前端源码 │ ├── dist/ # 构建后的静态文件(需要预先构建) │ ├── package.json │ └── vite.config.ts ├── dataBase/ # 数据库相关 └── tempFile/ # 临时文件 ``` ## 部署准备 ### 1. 安装Python依赖 ```bash pip install -r requirements.txt ``` ### 2. 构建前端项目(必须) ```bash cd frontend npm install npm run build ``` 构建完成后会在 `frontend/` 目录下生成 `dist/` 文件夹,包含所有静态文件。 ## 启动应用 ### 直接启动(推荐) ```bash python main.py ``` ## 访问地址 - **前端页面**: http://localhost:4070 - **API服务**: http://localhost:4070/api/* - **健康检查**: http://localhost:4070/health ## 部署优势 - ✅ **无需Node.js环境**: 生产环境只需Python环境 - ✅ **快速部署**: 预构建的静态文件,启动速度快 - ✅ **环境一致性**: 避免不同环境下的依赖问题 - ✅ **单一服务**: Flask同时提供API和静态文件服务 ## 开发模式 如果需要前端热重载开发: ```bash # 终端1:启动后端 python main.py # 终端2:启动前端开发服务器 cd frontend npm run dev # 访问 http://localhost:3000 ``` ## 项目迁移步骤 1. **复制项目文件**(包含已构建的 `frontend/dist/` 目录) 2. **安装Python依赖**: `pip install -r requirements.txt` 3. **配置数据库连接**(如需要) 4. **启动应用**: `python main.py` ## 注意事项 1. **前端必须预先构建**: 确保 `frontend/dist/` 目录存在 2. **数据库配置**: 确保MySQL数据库服务正在运行 3. **端口配置**: 默认使用4070端口,可在main.py中修改 4. **生产环境**: 建议使用gunicorn等WSGI服务器 ## 故障排除 ### 前端页面无法访问 - 检查 `frontend/dist/` 目录是否存在 - 如果不存在,运行 `cd frontend && npm run build` ### API接口报错 - 检查数据库连接配置 - 确认MySQL服务状态 - 查看控制台错误日志 ### 端口占用 - 检查4070端口是否被占用 - 可在main.py中修改端口配置 ## 构建脚本 如果需要重新构建前端: ```bash #!/bin/bash # build.sh cd frontend npm install npm run build echo "前端构建完成!" ```