|
|
|
@ -0,0 +1,36 @@ |
|
|
|
package com.inspect.bigmodel.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.inspect.base.core.utils.HttpClientUtils; |
|
|
|
import com.inspect.bigmodel.service.IBigModelResultService; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class BigModelResultServiceImpl implements IBigModelResultService { |
|
|
|
private final Logger log = LoggerFactory.getLogger(BigModelResultServiceImpl.class); |
|
|
|
@Value("${bigModel.record.url:http://192.168.110.119:8007}") |
|
|
|
private String bigModelRecordUrl; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject getBigModelResult() { |
|
|
|
log.info("-----调用大模型结果接口地址,url:{}", bigModelRecordUrl + "/bigModel/record/latest"); |
|
|
|
String resultStr; |
|
|
|
try { |
|
|
|
resultStr = HttpClientUtils.get(bigModelRecordUrl + "/bigModel/record/latest", ""); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("调用大模型结果接口,返回数据异常,exception:{}", e.getMessage()); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
log.error("调用大模型结果接口,返回数据,resultStr:{}", resultStr); |
|
|
|
JSONObject result = JSONObject.parseObject(resultStr); |
|
|
|
if (result != null && "200".equals(result.getString("code"))) { |
|
|
|
return result.getJSONObject("data"); |
|
|
|
} else { |
|
|
|
log.error("调用大模型结果接口,返回数据,resultStr:{}", resultStr); |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |