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