添加订单接口

This commit is contained in:
2025-10-28 09:34:17 +08:00
parent 90e28f056a
commit 4ebe4f9ac6
16 changed files with 146 additions and 97 deletions

View File

@@ -195,6 +195,11 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
//解析翻译结果
JSONObject intentResult = translateResult.getJSONObject("intent_result");
//宠物档案 todo
messageDO.setPetId(1l);
messageDO.setPetName(petName.get(speciesLabels));
messageDO.setPetAvatar(petAvatars.get(speciesLabels));
messageDO.setPetType(speciesLabels);
//识别物种,无法翻译音频
if (intentResult.getDouble("confidence")<0.7){
messageDO.setTransStatus(0);
@@ -205,7 +210,6 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
messageDO.setTransResult(petFailResult.get(RandomUtil.randomInt(petFailResult.size())));
return messageDO;
}
//都识别成功后 也有不同的翻译结果
JSONObject probabilities = intentResult.getJSONObject("probabilities");
String resultKey = probabilities.entrySet().stream()
@@ -217,11 +221,7 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
List<String> emoList = successMap.get(emo);
messageDO.setTransStatus(1);
messageDO.setTransResult(emoList.get(RandomUtil.randomInt(emoList.size())));
//宠物档案 todo
messageDO.setPetId(1l);
messageDO.setPetName(petName.get(speciesLabels));
messageDO.setPetAvatar(petAvatars.get(speciesLabels));
messageDO.setPetType(speciesLabels);
return messageDO;
}