Browse Source

fix:完善问题选项问题解析

zhongwei
haungxing 7 months ago
parent
commit
69a60eb94e
  1. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java
  2. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

9
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java

@ -13,6 +13,7 @@ import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService;
import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService; import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService;
import com.hnac.hzims.bigmodel.interactive.service.IParamsService; import com.hnac.hzims.bigmodel.interactive.service.IParamsService;
import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@ -170,15 +171,15 @@ public class InteractiveServiceImpl implements IInteractiveService {
Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> {
throw new ServiceException("远程调用大模型【获取问题答案】接口失败!"); throw new ServiceException("远程调用大模型【获取问题答案】接口失败!");
}); });
XxlJobLogger.log("接收到答案:"+JSON.toJSONString(response.body()));
List<AnswerVO> result = JSONArray.parseArray(response.body(), AnswerVO.class); List<AnswerVO> result = JSONArray.parseArray(response.body(), AnswerVO.class);
result.stream().filter(answerVO -> answerVO.getRunning() == 0).forEach(answerVO -> { result.stream().filter(answerVO -> answerVO.getRunning() == 0).forEach(answerVO -> {
Object[] extras = answerVO.getExtra(); Object[] extras = answerVO.getExtras();
if(ObjectUtil.isEmpty(answerVO.getExtra()) || extras.length == 0){ if(ObjectUtil.isEmpty(answerVO.getExtras()) || extras.length == 0){
return; return;
} }
List<String> extraList = Arrays.stream(extras).map(Object::toString).map(extraResolveStrategyService::resolve).map(JSON::toJSONString).collect(Collectors.toList()); List<String> extraList = Arrays.stream(extras).map(Object::toString).map(extraResolveStrategyService::resolve).map(JSON::toJSONString).collect(Collectors.toList());
answerVO.setExtra(extraList.toArray(new String[extraList.size()])); answerVO.setExtras(extraList.toArray(new String[extraList.size()]));
}); });
return result; return result;
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/AnswerVO.java

@ -45,6 +45,6 @@ public class AnswerVO implements Serializable {
private String answer; private String answer;
@ApiModelProperty("其它调用的参数") @ApiModelProperty("其它调用的参数")
private Object[] extra; private Object[] extras;
} }

Loading…
Cancel
Save