AI鱼答答项目的业务逻辑问题

private String getAiTestScoringUserMessage(App app, List questionContentDTOList, List choices) { HashMap<String, String> map = new HashMap<>(); map.put("专业指南", "你必须先给出5个推荐的专业再进行论述,注意,要根据用户选择的是物理还是历史来推荐相关专业,若现在了历史,则不能推荐与物理相关的专业");

text
复制代码
StringBuilder userMessage = new StringBuilder(); userMessage.append(app.getAppName()).append("\n"); userMessage.append(app.getAppDesc()).append("\n"); QueryWrapper<Question> objectQueryWrapper = new QueryWrapper<>(); objectQueryWrapper.eq("appId",app.getId()); Question question = questionService.getOne(objectQueryWrapper); QuestionVO questionVO = QuestionVO.objToVo(question); List<QuestionContentDTO> questionContentdto = questionVO.getQuestionContent(); List<QuestionAnswerDTO> questionAnswerDTOList = new ArrayList<>(); for (int i = 0; i < questionContentDTOList.size(); i++) { QuestionAnswerDTO questionAnswerDTO = new QuestionAnswerDTO(); questionAnswerDTO.setTitle(questionContentDTOList.get(i).getTitle()); // 根据题目索引与选项查找到对应描述 QuestionContentDTO questionContentDTO = questionContentdto.get(i); List<QuestionContentDTO.Option> options = questionContentDTO.getOptions(); for(QuestionContentDTO.Option option:options){ if(option.getKey().equals(choices.get(i))){

// questionAnswerDTO.setUserAnswer(choices.get(i)+option.getValue()); }

text
复制代码
}

// questionAnswerDTO.setUserAnswer(choices.get(i)); //此代码存在逻辑错误 questionAnswerDTOList.add(questionAnswerDTO); } userMessage.append(JSONUtil.toJsonStr(questionAnswerDTOList));

text
复制代码
String addMessage = map.get(app.getAppName()); if(addMessage!=null){ userMessage.append(addMessage); }

// System.out.println(userMessage.toString());

text
复制代码
return userMessage.toString(); } 代码中的 questionAnswerDTO.setUserAnswer(choices.get(i)); 是存在逻辑错误的,因为这里只保留了option的key而没有添加上value
0个评论
点击登录,快来和大家讨论吧~
表情
图片
暂无评论
鱼友8374
下载 APP