Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
yang_shj 3 months ago
parent
commit
5ac87299fa
  1. 14
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java
  2. 24
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java
  3. 2
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml

14
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java

@ -65,6 +65,20 @@ public class ProjectContentEntity extends BaseEntity {
private String checkTypeSon;
/**
* 检测类型子类(多组)
*/
@ApiModelProperty(value = "检测类型子类(多组)")
@TableField(exist = false)
private String multiCheckTypeSon;
/**
* ai识别分析方式设备或大模型
*/
@ApiModelProperty(value = "ai识别分析方式,设备或大模型")
@TableField(exist = false)
private String analyserType;
/**
* 表针识别表盘ID
*/
@ApiModelProperty(value = "表针识别,表盘ID")

24
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java

@ -1,5 +1,6 @@
package com.hnac.hzims.bigmodel.zhipuai.handler;
import cn.hutool.core.lang.Assert;
import com.hnac.hzinfo.exception.HzServiceException;
import com.zhipu.oapi.Constants;
import com.zhipu.oapi.service.v4.model.ChatCompletionRequest;
@ -35,7 +36,7 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
@Override
public ModelApiResponse sendRequest(String text, String url) {
ChatCompletionRequest request = getRequest(text, url);
log.info("send zhipu ai request :{}", Optional.ofNullable(request).map(req -> JsonUtil.toJson(req)).orElse("null"));
log.info("send zhipu ai request :{}", Optional.ofNullable(request).map(JsonUtil::toJson).orElse("null"));
return client.invokeModelApi(request);
}
@ -70,19 +71,18 @@ public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler {
@Override
public String getResult(String text, String url) {
ModelApiResponse response = sendRequest(text, url);
log.info("get zhi pu ai response : {}", Optional.ofNullable(response).map(resp -> JsonUtil.toJson(resp)).orElse("null"));
if (response.isSuccess()) {
try {
String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString();
resultJson = resultJson.substring(resultJson.indexOf("{"), resultJson.lastIndexOf("}") + 1).trim();
return resultJson;
} catch (Exception e) {
log.info("get data from response error", e);
}
} else {
log.info("get zhi pu ai response : {}", Optional.ofNullable(response).map(JsonUtil::toJson).orElse("null"));
Assert.<HzServiceException>isTrue(Objects.nonNull(response) && response.isSuccess(), () -> {
throw new HzServiceException(response.getMsg());
});
try {
String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString();
resultJson = resultJson.substring(resultJson.indexOf("{"), resultJson.lastIndexOf("}") + 1).trim();
return resultJson;
} catch (Exception e) {
log.info("get data from response error", e);
throw new HzServiceException("获取数据失败");
}
return null;
}
}

2
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml

@ -3,7 +3,7 @@
<mapper namespace="com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper">
<select id="getListByProjectId" resultType="com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity">
SELECT t.*,c.code, c.name, c.description, c.check_type,c.CHECK_TYPE_SON,c.CAMERA_ADDR,c.OTHER_PARAM, c.record_type, c.CLOCK_ID, c.CAMERA_ID, c.DICT_TYPE,c.CHECK_VAL
SELECT t.*,c.code, c.name, c.description, c.check_type,c.CHECK_TYPE_SON,c.CAMERA_ADDR,c.OTHER_PARAM,c.ANALYSER_TYPE,c.MULTI_CHECK_TYPE_SON,c.record_type, c.CLOCK_ID, c.CAMERA_ID, c.DICT_TYPE,c.CHECK_VAL
from hz_st_re_project_content t
left JOIN hz_st_re_content c on (t.content_id=c.id)
where t.project_id=#{projectId} AND t.is_deleted=0 ORDER BY t.SORT DESC

Loading…
Cancel
Save