diff --git a/hzims-service-api/target/classes/META-INF/build-info.properties b/hzims-service-api/target/classes/META-INF/build-info.properties new file mode 100644 index 0000000..907791f --- /dev/null +++ b/hzims-service-api/target/classes/META-INF/build-info.properties @@ -0,0 +1,5 @@ +build.artifact=hzims-service-api +build.group=com.hnac.hzims +build.name=hzims-service-api +build.time=2024-08-12T06\:09\:01.772Z +build.version=4.0.0-SNAPSHOT diff --git a/hzims-service/hzims-big-model/pom.xml b/hzims-service/hzims-big-model/pom.xml index 77bd234..d3624b5 100644 --- a/hzims-service/hzims-big-model/pom.xml +++ b/hzims-service/hzims-big-model/pom.xml @@ -78,6 +78,11 @@ dynamic-datasource-spring-boot-starter 3.5.0 + + cn.bigmodel.openapi + oapi-java-sdk + release-V4-2.0.2 + diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java new file mode 100644 index 0000000..71bf8a7 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfig.java @@ -0,0 +1,26 @@ +package com.hnac.hzims.bigmodel.zhipuai.config; + +import com.zhipu.oapi.ClientV4; +import lombok.AllArgsConstructor; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.Resource; + +/** + * @Author: ypj + * @Date: 2024/8/9 17:01 + */ +@Configuration +@EnableConfigurationProperties(ZhipuAiConfigProperties.class) +@AllArgsConstructor +public class ZhipuAiConfig { + + private ZhipuAiConfigProperties properties; + + @Bean("clientV4") + public ClientV4 clientV4() { + return new ClientV4.Builder(properties.getApiSecret()).build(); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java new file mode 100644 index 0000000..827fae6 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/config/ZhipuAiConfigProperties.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.bigmodel.zhipuai.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cloud.context.config.annotation.RefreshScope; +import org.springframework.stereotype.Component; + +/** + * @Author: ypj + * @Date: 2024/8/8 14:03 + */ +@Data +@ConfigurationProperties(prefix = "zhipuai") +public class ZhipuAiConfigProperties { + + private String apiSecret; + + private String url; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java new file mode 100644 index 0000000..bfd686d --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisModel.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.bigmodel.zhipuai.constants; + +import lombok.Getter; + +/** + * @Author: ypj + * @Date: 2024/8/9 9:50 + */ +@Getter +public enum AnalysisModel implements BaseEnum { + + GLM_4("glm-4", "GLM-4模型"), + GLM_4V("glm-4v", "GLM-4V模型"), + COG_VIDEO_X("cogvideox", "CogVideoX模型"), + COG_VIEW("cogvideox", "CogVideoX模型"), + GLM_4_ALL_TOOLS("glm-4-alltool", "GLM-4-AllTools模型"); + + private final String code; + + private final String msg; + + AnalysisModel(String code, String msg) { + this.code = code; + this.msg = msg; + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java new file mode 100644 index 0000000..29e0c8e --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/AnalysisResultType.java @@ -0,0 +1,32 @@ +package com.hnac.hzims.bigmodel.zhipuai.constants; + +import lombok.Getter; +import org.apache.poi.ss.formula.functions.T; + +import java.math.BigDecimal; + +/** + * @Author: ypj + * @Date: 2024/8/8 15:27 + */ +@Getter +public enum AnalysisResultType implements BaseEnum { + BOOLEAN("BOOLEAN", "是非判断", "是", Boolean.class), + NUMBER("NUMBER", "确定数量", null, Integer.class), + DECIMAL("DECIMAL", "获取数值", null, BigDecimal.class); + + private final String code; + + private final String msg; + + private final String condition; + + private final Class clazz; + + AnalysisResultType(String code, String msg, String condition, Class clazz) { + this.code = code; + this.msg = msg; + this.condition = condition; + this.clazz = clazz; + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java new file mode 100644 index 0000000..6c40f4c --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/constants/BaseEnum.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.bigmodel.zhipuai.constants; + +/** + * @Author: ypj + * @Date: 2024/8/8 15:42 + */ +public interface BaseEnum { + U getCode(); + + String getMsg(); + + static T getInstance(U code, Class clazz) { + T[] baseEnums = clazz.getEnumConstants(); + for (T baseEnum : baseEnums) { + if (baseEnum.getCode().equals(code)) { + return baseEnum; + } + } + return null; + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java new file mode 100644 index 0000000..13db651 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/controller/ZhipuController.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.bigmodel.zhipuai.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisService; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisRequest; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisResponse; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * @Author: ypj + * @Date: 2024/8/8 16:36 + */ +@RestController +@RequestMapping("zhipu") +@Api(value = "智谱", tags = "智谱") +@AllArgsConstructor +public class ZhipuController { + + private final ZhipuAnalysisService analysisService; + + @PostMapping("/analysis") + @ApiOperation("分析") + @ApiOperationSupport(order = 1) + public R analysis(@RequestBody @Valid ZhipuAnalysisRequest request) { + return R.data(analysisService.analysis(request)); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java new file mode 100644 index 0000000..ffac88d --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/entity/ZhipuAnalysisInfoEntity.java @@ -0,0 +1,25 @@ +package com.hnac.hzims.bigmodel.zhipuai.entity; + +import lombok.Data; +import org.springblade.core.mp.base.BaseEntity; + +/** + * @Author: ypj + * @Date: 2024/8/8 15:17 + */ +@Data +public class ZhipuAnalysisInfoEntity extends BaseEntity { + + private String resultType; + + private String name; + + private String code; + + private String model; + + private String requestContent; + + private String resultStrategy; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java new file mode 100644 index 0000000..9a86c28 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/AbstractZhipuAnalysisHandler.java @@ -0,0 +1,23 @@ +package com.hnac.hzims.bigmodel.zhipuai.handler; + +import com.zhipu.oapi.ClientV4; + +import javax.annotation.Resource; +import java.util.Base64; + +/** + * @Author: ypj + * @Date: 2024/8/12 8:44 + */ +public abstract class AbstractZhipuAnalysisHandler implements ZhipuAnalyser { + protected final String requestIdTemplate = "hzims-%d"; + protected final String resultKey = "结果"; + + @Resource + protected ClientV4 client; + + @Override + public String getBase64(String url) { + return Base64.getEncoder().encodeToString(getFileBytes(url)); + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java new file mode 100644 index 0000000..4bb7d5f --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalyser.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.bigmodel.zhipuai.handler; + +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; + +/** + * @Author: ypj + * @Date: 2024/8/8 14:45 + */ +public interface ZhipuAnalyser { + + String getBase64(String url); + + byte[] getFileBytes(String url); + + String getAnalysisStrategy(); + + String getAnalysisModel(); + + default boolean isSupport(String modelName) { + return getAnalysisStrategy().equals(modelName); + } + + Resp sendRequest(ZhipuAnalysisInfoEntity info, String url); + + Req getRequest(ZhipuAnalysisInfoEntity info, String url); + + String getResult(ZhipuAnalysisInfoEntity info, String url); +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java new file mode 100644 index 0000000..34f390e --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisFactory.java @@ -0,0 +1,37 @@ +package com.hnac.hzims.bigmodel.zhipuai.handler; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @Author: ypj + * @Date: 2024/8/9 10:47 + */ +@Component +@AllArgsConstructor +@Slf4j +public class ZhipuAnalysisFactory { + private final List analysisStrategyList; + + private static final Map analysisStrategyMap = new ConcurrentHashMap<>(); + + public ZhipuAnalyser getAnalysisStrategy(final String modelName) { + ZhipuAnalyser result = ZhipuAnalysisFactory.analysisStrategyMap.get(modelName); + if (Objects.nonNull(result)) { + return result; + } + Optional strategyOptional = analysisStrategyList.stream().filter(strategy -> strategy.isSupport(modelName)).findFirst(); + if (strategyOptional.isPresent()) { + result = strategyOptional.get(); + ZhipuAnalysisFactory.analysisStrategyMap.put(modelName, result); + } + return result; + } +} 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 new file mode 100644 index 0000000..609eaf8 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerGlm4v.java @@ -0,0 +1,95 @@ +package com.hnac.hzims.bigmodel.zhipuai.handler; + +import com.hnac.hzims.bigmodel.zhipuai.constants.AnalysisModel; +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; +import com.zhipu.oapi.ClientV4; +import com.zhipu.oapi.Constants; +import com.zhipu.oapi.service.v4.model.ChatCompletionRequest; +import com.zhipu.oapi.service.v4.model.ChatMessage; +import com.zhipu.oapi.service.v4.model.ChatMessageRole; +import com.zhipu.oapi.service.v4.model.ModelApiResponse; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.jackson.JsonUtil; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: ypj + * @Date: 2024/8/12 9:20 + */ +@Service +@AllArgsConstructor +@Slf4j +public class ZhipuAnalysisHandlerGlm4v extends AbstractZhipuAnalysisHandler { + + @Override + public String getAnalysisStrategy() { + return AnalysisModel.GLM_4V.getCode(); + } + + @Override + public String getAnalysisModel() { + return AnalysisModel.GLM_4V.getCode(); + } + + + @Override + public byte[] getFileBytes(String url) { + return new byte[0]; + } + + @Override + public ModelApiResponse sendRequest(ZhipuAnalysisInfoEntity info, String url) { + ChatCompletionRequest request = getRequest(info, url); + log.info("send zhipu ai request :{}", request); + return client.invokeModelApi(request); + } + + @Override + public ChatCompletionRequest getRequest(ZhipuAnalysisInfoEntity info, String url) { + List messages = new ArrayList<>(); + List> contentList = new ArrayList<>(); + Map textMap = new HashMap<>(); + textMap.put("type", "text"); + textMap.put("text", info.getRequestContent()); + Map typeMap = new HashMap<>(); + typeMap.put("type", "image_url"); + Map urlMap = new HashMap<>(); + urlMap.put("url", getBase64(url)); + typeMap.put("image_url", urlMap); + contentList.add(textMap); + contentList.add(typeMap); + ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), contentList); + messages.add(chatMessage); + String requestId = String.format(requestIdTemplate, System.currentTimeMillis()); + + ChatCompletionRequest request = ChatCompletionRequest.builder() + .model(getAnalysisModel()) + .stream(Boolean.FALSE) + .invokeMethod(Constants.invokeMethod) + .messages(messages) + .requestId(requestId) + .build(); + return request; + } + + @Override + public String getResult(ZhipuAnalysisInfoEntity info, String url) { + ModelApiResponse response = sendRequest(info, url); + log.info("get zhi pu ai response : {}", JsonUtil.toJson(response)); + if (response.isSuccess()) { + String resultJson = response.getData().getChoices().get(0).getMessage().getContent().toString(); + resultJson = resultJson.substring(resultJson.indexOf("{"), resultJson.indexOf("}") + 1).trim(); + Map resultMap = JsonUtil.toMap(resultJson); + return resultMap.get(resultKey).toString(); + } else { + return "访问失败"; + } + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerTest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerTest.java new file mode 100644 index 0000000..4527301 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/handler/ZhipuAnalysisHandlerTest.java @@ -0,0 +1,57 @@ +package com.hnac.hzims.bigmodel.zhipuai.handler; + +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; +import com.zhipu.oapi.Constants; +import com.zhipu.oapi.service.v4.model.ChatCompletionRequest; +import com.zhipu.oapi.service.v4.model.ChatMessage; +import com.zhipu.oapi.service.v4.model.ChatMessageRole; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Author: ypj + * @Date: 2024/8/12 10:11 + */ +@Service +@AllArgsConstructor +@Slf4j +public class ZhipuAnalysisHandlerTest extends ZhipuAnalysisHandlerGlm4v { + private final String model = "test"; + + @Override + public String getAnalysisStrategy() { + return model; + } + + @Override + public byte[] getFileBytes(String url) { + File file = new File(url); + FileInputStream fileInputStream = null; + try { + fileInputStream = new FileInputStream(file); + byte[] bytes = new byte[(int) file.length()]; + fileInputStream.read(bytes); + return bytes; + } catch (Exception e) { + log.error("读取文件出错", e); + } finally { + if (null != fileInputStream) { + try { + fileInputStream.close(); + } catch (IOException ignore) { + } + } + } + return null; + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/ZhipuAnalysisService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/ZhipuAnalysisService.java new file mode 100644 index 0000000..08290a8 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/ZhipuAnalysisService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.bigmodel.zhipuai.service; + +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisRequest; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisResponse; + +/** + * @Author: ypj + * @Date: 2024/8/12 10:25 + */ +public interface ZhipuAnalysisService { + + ZhipuAnalysisResponse analysis(ZhipuAnalysisRequest request); + + ZhipuAnalysisInfoEntity getAnalysisInfo(ZhipuAnalysisRequest request); +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java new file mode 100644 index 0000000..b0eed30 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/service/impl/ZhipuAnalysisServiceImpl.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.bigmodel.zhipuai.service.impl; + +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; +import com.hnac.hzims.bigmodel.zhipuai.handler.ZhipuAnalyser; +import com.hnac.hzims.bigmodel.zhipuai.handler.ZhipuAnalysisFactory; +import com.hnac.hzims.bigmodel.zhipuai.service.ZhipuAnalysisService; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisRequest; +import com.hnac.hzims.bigmodel.zhipuai.vo.ZhipuAnalysisResponse; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * @Author: ypj + * @Date: 2024/8/12 10:26 + */ +@Service +@AllArgsConstructor +@Slf4j +public class ZhipuAnalysisServiceImpl implements ZhipuAnalysisService { + private final ZhipuAnalysisFactory analysisFactory; + + @Override + public ZhipuAnalysisResponse analysis(ZhipuAnalysisRequest request) { + ZhipuAnalysisInfoEntity info = getAnalysisInfo(request); + ZhipuAnalyser analyser = analysisFactory.getAnalysisStrategy(info.getModel()); + String resultStr = analyser.getResult(info, request.getUrl()); + ZhipuAnalysisResponse response = new ZhipuAnalysisResponse(); + response.setResultStr(resultStr); + return response; + } + + @Override + public ZhipuAnalysisInfoEntity getAnalysisInfo(ZhipuAnalysisRequest request) { + if (Objects.isNull(request.getCode())) { + return request.toAnalysisInfo(); + } + return null; + } + + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisRequest.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisRequest.java new file mode 100644 index 0000000..46b0768 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisRequest.java @@ -0,0 +1,37 @@ +package com.hnac.hzims.bigmodel.zhipuai.vo; + +import com.hnac.hzims.bigmodel.zhipuai.entity.ZhipuAnalysisInfoEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: ypj + * @Date: 2024/8/12 10:23 + */ +@Data +@ApiModel(value = "智谱分析请求", description = "智谱分析请求") +public class ZhipuAnalysisRequest { + @ApiModelProperty("模型编码") + private String code; + + @ApiModelProperty("模型名称") + private String model; + + @ApiModelProperty("文件地址") + private String url; + + @ApiModelProperty("发送内容") + private String content; + + @ApiModelProperty("额外信息") + private String message; + + public ZhipuAnalysisInfoEntity toAnalysisInfo() { + ZhipuAnalysisInfoEntity info = new ZhipuAnalysisInfoEntity(); + info.setModel(this.getModel()); + info.setRequestContent(this.content); + info.setModel(this.getModel()); + return info; + } +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisResponse.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisResponse.java new file mode 100644 index 0000000..592e3af --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/zhipuai/vo/ZhipuAnalysisResponse.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.bigmodel.zhipuai.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @Author: ypj + * @Date: 2024/8/12 10:23 + */ +@Data +@ApiModel(value = "智谱分析返回",description = "智谱分析返回") +public class ZhipuAnalysisResponse { + + @ApiModelProperty("返回结果") + String resultStr; +}