diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java index 508c4f6..16b621a 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectContentEntity.java +++ b/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") diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java index 7dae059..0f0925a 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java +++ b/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.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; } } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml index 9f9d5d5..517898c 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/mapper/ProjectContentMapper.xml @@ -3,7 +3,7 @@