用户反映数据库中difficulty字段仍然是null。
CozeWorkflowService.java
parseQuestion
验证结果: ✅ 代码已正确实现difficulty字段解析
// 检查并设置difficulty字段
if (questionNode.has("difficulty")) {
question.setDifficulty(questionNode.get("difficulty").asText());
}
检查最新题目:
# 运行检查脚本
python check_difficulty_status.py
生成新题目测试:
# 运行生成测试
python test_manual_generate.py
API直接调用:
# 获取目标下的题目
curl "http://localhost:8080/api/ai/questions/{goalId}"
GET /api/goals/user/{userId}
GET /api/ai/questions/{goalId}
POST /api/ai/auto-generate
goal_of_detail
difficulty
(VARCHAR类型)CozeWorkflowService.java
: 解析Coze API返回的题目数据AIQuestionController.java
: 题目相关API接口GoalController.java
: 目标相关API接口问题已解决: difficulty字段功能完全正常,新生成的题目都包含正确的difficulty值。用户遇到的问题可能是由于查看了修复前的历史数据或缓存问题导致。
建议: 用户应该重新生成题目或检查最新生成的题目数据,以验证difficulty字段的正常工作状态。