# PythonAI7 **Repository Path**: qingchua/python-ai7 ## Basic Information - **Project Name**: PythonAI7 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-23 - **Last Updated**: 2026-05-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 智慧在线教育平台 基于 Python FastAPI + HTML/CSS/JS 的智能在线教育平台,涵盖学生端、教师端、AI问答、积分签到等核心功能。 ## 项目结构 ``` PythonAI7/ ├── backend/ # 后端项目 │ ├── app/ │ │ ├── __init__.py │ │ ├── main.py # FastAPI主应用入口 │ │ ├── core/ # 核心配置 │ │ │ ├── config.py # 全局配置(数据库、JWT、AI等) │ │ │ ├── database.py # 数据库连接与会话管理 │ │ │ └── security.py # JWT认证与密码加密 │ │ ├── models/ # 数据库模型(25张表) │ │ │ ├── user.py # 用户表 │ │ │ ├── student_profile.py │ │ │ ├── teacher_profile.py │ │ │ ├── login_log.py │ │ │ ├── point_record.py │ │ │ ├── subject.py │ │ │ ├── knowledge_point.py │ │ │ ├── course.py │ │ │ ├── course_section.py │ │ │ ├── learning_progress.py │ │ │ ├── question.py │ │ │ ├── question_favorite.py │ │ │ ├── wrong_question.py │ │ │ ├── exam.py │ │ │ ├── exam_question.py │ │ │ ├── exam_record.py │ │ │ ├── exam_answer_detail.py │ │ │ ├── ai_chat_session.py │ │ │ ├── ai_chat_message.py │ │ │ ├── check_in_record.py │ │ │ ├── check_in_status.py │ │ │ ├── teaching_resource.py │ │ │ ├── teaching_video.py │ │ │ ├── resource_favorite.py │ │ │ └── course_review.py │ │ ├── schemas/ # Pydantic数据模型 │ │ │ ├── auth.py │ │ │ ├── user.py │ │ │ ├── course.py │ │ │ ├── question.py │ │ │ ├── exam.py │ │ │ ├── ai_chat.py │ │ │ ├── check_in.py │ │ │ ├── resource.py │ │ │ ├── point.py │ │ │ └── common.py │ │ ├── api/ # API路由 │ │ │ ├── auth.py # 认证接口 │ │ │ ├── user.py # 用户接口 │ │ │ ├── course.py # 课程接口 │ │ │ ├── question.py # 题库接口 │ │ │ ├── exam.py # 考试接口 │ │ │ ├── ai_chat.py # AI问答接口(SSE流式) │ │ │ ├── check_in.py # 签到接口 │ │ │ └── resource.py # 资源接口 │ │ ├── services/ # 业务逻辑层 │ │ │ ├── auth_service.py │ │ │ ├── point_service.py │ │ │ ├── check_in_service.py │ │ │ ├── exam_service.py │ │ │ └── ai_chat_service.py │ │ └── utils/ # 工具类 │ │ ├── response.py # 统一响应格式 │ │ ├── file_upload.py # 文件上传工具 │ │ ├── llm_client.py # AI大模型客户端 │ │ └── analysis.py # 数据分析工具 │ ├── requirements.txt │ └── Dockerfile ├── frontend/ # 前端项目 │ ├── css/style.css # 全局样式 │ ├── js/app.js # 公共JS框架 │ ├── index.html # 首页/落地页 │ ├── login.html # 登录页 │ ├── register.html # 注册页 │ ├── forgot-password.html # 忘记密码页 │ ├── search.html # 全局搜索页 │ ├── points-rules.html # 积分规则说明页 │ ├── 404.html # 404页面 │ ├── 500.html # 500页面 │ ├── student/ # 学生端页面(20个) │ │ ├── home.html │ │ ├── courses.html │ │ ├── course-detail.html │ │ ├── course-learn.html │ │ ├── questions.html │ │ ├── question-result.html │ │ ├── wrong-questions.html │ │ ├── exams.html │ │ ├── exam-detail.html │ │ ├── exam-take.html │ │ ├── exam-result.html │ │ ├── exam-records.html │ │ ├── ai-chat.html │ │ ├── ai-chat-history.html │ │ ├── check-in.html │ │ ├── profile.html │ │ ├── points.html │ │ ├── favorites.html │ │ └── progress.html │ ├── teacher/ # 教师端页面(12个) │ │ ├── home.html │ │ ├── profile.html │ │ ├── points.html │ │ ├── analytics.html │ │ ├── reviews.html │ │ ├── security.html │ │ ├── resources/ │ │ │ ├── upload.html │ │ │ ├── index.html │ │ │ └── edit.html │ │ └── videos/ │ │ ├── upload.html │ │ ├── index.html │ │ └── edit.html │ └── Dockerfile ├── docker-compose.yml # Docker编排 ├── nginx.conf # Nginx配置 ├── .env.example # 环境变量模板 └── README.md # 项目说明 ``` ## 技术栈 | 层级 | 技术 | |------|------| | 后端框架 | Python 3.12 + FastAPI | | ORM | SQLAlchemy (异步) | | 认证 | JWT (Bearer Token) | | 数据分析 | NumPy + Pandas | | 数据库 | MySQL 9.3 | | 前端 | HTML + CSS + JavaScript | | 数据可视化 | ECharts | | AI接口 | OpenAI API (SSE流式) | | 部署 | Docker + Nginx | ## 快速开始 ### 1. 环境准备 - Python 3.12+ - MySQL 9.3+ - Node.js 18+ (可选) - Docker & Docker Compose (推荐) ### 2. Docker部署(推荐) ```bash # 复制环境变量配置 cp .env.example .env # 编辑 .env 文件,填入实际配置 # 启动所有服务 docker-compose up -d # 查看日志 docker-compose logs -f ``` 访问 http://localhost 即可使用平台。 ### 3. 本地开发 ```bash # 启动MySQL,创建数据库 mysql -u root -p CREATE DATABASE edu_platform CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # 后端 cd backend pip install -r requirements.txt uvicorn app.main:app --reload --port 8000 # 前端(使用任意HTTP服务器) cd frontend # Python方式 python -m http.server 3000 # 或 Node方式 npx serve . ``` ## 核心功能模块 ### 学生端 - **知识教学**:课程浏览、学习、进度跟踪、收藏 - **题库系统**:题目筛选、在线答题、自动批改、错题本 - **考试系统**:在线考试、倒计时、自动交卷、成绩查询 - **AI问答**:SSE流式问答、多轮对话、历史记录、积分扣减 - **积分签到**:每日签到、连续签到奖励、积分收支明细 - **用户中心**:个人信息、学习数据看板、收藏管理 ### 教师端 - **资源管理**:教学资源/视频上传、编辑、审核状态跟踪 - **数据统计**:资源使用数据、下载/收藏/评价统计 - **积分收益**:上传资源/视频获得积分、收益趋势 - **账号安全**:修改密码、登录日志 ## API文档 启动后端后访问: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## 数据库 共25张数据表,涵盖用户、课程、题库、考试、AI问答、签到、资源、评价等模块。 启动后端时会自动创建表结构(`create_all`)。 ## 注意事项 1. 生产环境请修改 `.env` 中的 `SECRET_KEY` 和数据库密码 2. AI问答功能需要配置有效的 `LLM_API_KEY`(智谱AI) 3. 上传文件默认存储在 `./uploads` 目录 4. Nginx配置了SSE支持,确保AI流式问答正常工作