AI_Homework_Correcttion/README.md

91 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# AI作业批改系统
本项目通过调用Dify Workflow API实现自动化AI作业批改功能。系统包含两个核心脚本
1. `grade_assignments.py` - 主批改程序
2. `check_ymls.py` - YML配置文件验证工具
## 核心功能
- 读取Excel作业提交记录使用openpyxl
- 验证YML配置文件的完整性和格式
- 调用Dify API进行作业批改
- 自动保存批改结果
- 提供详细的错误报告
## 系统要求
```bash
pip install -r requirements.txt
```
## 文件结构
```
ai_homework_correction/
├── ai作业/ # 作业相关文件
│ ├── AI考试作业.xlsx # 学生作业提交Excel
│ └── 作业/ # 学生YML作业文件
├── results/ # 批改结果输出
├── docs/ # 文档
├── source/
│ ├── grade_assignments.py # 主批改程序
│ ├── check_ymls.py # YML验证工具
│ └── test_script.py # 测试脚本
```
## 使用指南
### 1. 验证YML文件
```bash
python source/check_ymls.py
```
功能:
- 检查每个学生是否有对应的YML文件
- 验证YML文件格式有效性
- 生成详细检查报告
### 2. 执行批改
```bash
python source/grade_assignments.py
```
流程:
1. 读取Excel学生名单
2. 匹配对应的YML作业文件
3. 调用Dify API批改
4. 保存结果到results/
## 配置说明
1. 在`source/grade_assignments.py`中配置:
```python
API_KEY = "your-api-key" # Dify API密钥
WORKFLOW_ID = "your-workflow-id" # 工作流ID
API_BASE_URL = "http://your-dify-server/v1" # API地址
```
2. Excel文件要求
- 必须包含列填写人、工作流程描述、Dify工作流解决方案设计
- 文件路径ai作业/AI考试作业.xlsx
3. YML文件要求
- 存放在ai作业/作业/目录下
- 文件名格式:*_学生姓名_*.yml
## API文档
详细规范参考:[docs/workflow_api.md](docs/workflow_api.md)
## 注意事项
1. 确保:
- 网络可访问Dify服务器
- 文件大小符合API限制
- YML文件格式正确
2. 建议:
- 先运行check_ymls.py验证文件
- 定期清理results/目录