Browse Source

fix: 业务模块调用大模型接口修改为可配置

zhongwei
haungxing 4 months ago
parent
commit
2622b1a00e
  1. 16
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java
  2. 3
      hzims-service/gglm-big-model/src/main/resources/template/template.yml
  3. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  4. 3
      hzims-service/ticket/src/main/resources/template/template.yml
  5. 3
      hzims-service/ticket/src/test/resources/application-test.yml

16
hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/interactive/service/impl/ControlAnswerResolveServiceImpl.java

@ -8,9 +8,11 @@ import com.hnac.gglm.bigmodel.interactive.factory.AnswerResolveFactory;
import com.hnac.gglm.bigmodel.interactive.service.IAnswerResolveService; import com.hnac.gglm.bigmodel.interactive.service.IAnswerResolveService;
import com.hnac.gglm.bigmodel.interactive.vo.AnswerVO; import com.hnac.gglm.bigmodel.interactive.vo.AnswerVO;
import com.hnac.gglm.bigmodel.interactive.vo.ExtraVO; import com.hnac.gglm.bigmodel.interactive.vo.ExtraVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.ParamCache; import org.springblade.system.cache.ParamCache;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hnac.gglm.bigmodel.interactive.constants.ParamKeyConstants; import com.hnac.gglm.bigmodel.interactive.constants.ParamKeyConstants;
@ -23,8 +25,14 @@ import java.util.Map;
*/ */
@Service(AnswerResolveFactory.CONTROL_DEVICE_SERVICE) @Service(AnswerResolveFactory.CONTROL_DEVICE_SERVICE)
@Slf4j @Slf4j
@RequiredArgsConstructor
public class ControlAnswerResolveServiceImpl implements IAnswerResolveService { public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
@Value("${gglm.remote.initiateRobotPlan}")
private String initiateRobotPlanUrl;
@Value("${gglm.remote.initiateVideoTask}")
private String initiateVideoTaskUrl;
@Override @Override
public AnswerVO resolve(AnswerVO answer) { public AnswerVO resolve(AnswerVO answer) {
Object[] extraArray = this.extraStream(answer).map(this::getExtra).toArray(); Object[] extraArray = this.extraStream(answer).map(this::getExtra).toArray();
@ -38,14 +46,14 @@ public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
JSONObject params = originExtra.getJSONObject("params"); JSONObject params = originExtra.getJSONObject("params");
if(Func.isNotEmpty(params) && Func.isNotEmpty(params.getString("itemId"))) { if(Func.isNotEmpty(params) && Func.isNotEmpty(params.getString("itemId"))) {
String itemId = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_CODE); String itemId = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_CODE);
String url = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_URL); //String url = ParamCache.getValue(ParamKeyConstants.VIDEO_INSPECTION_URL);
if(Func.isNotEmpty(itemId) && Func.isNotEmpty(url) if(Func.isNotEmpty(itemId) && Func.isNotEmpty(initiateVideoTaskUrl)
&& itemId.equals(params.getString("itemId")) && Func.isNotEmpty(params.getString("stationId"))) { && itemId.equals(params.getString("itemId")) && Func.isNotEmpty(params.getString("stationId"))) {
log.info("控制指令传参为:{}", JSON.toJSONString(originExtra)); log.info("控制指令传参为:{}", JSON.toJSONString(originExtra));
String stationId = params.getString("stationId"); String stationId = params.getString("stationId");
HashMap<String, String> param = new HashMap<>(1); HashMap<String, String> param = new HashMap<>(1);
param.put("stationId",stationId); param.put("stationId",stationId);
String body = HttpRequest.post(url).body(JSON.toJSONString(param)).execute().body(); String body = HttpRequest.post(initiateVideoTaskUrl).body(JSON.toJSONString(param)).execute().body();
params.put("data",body); params.put("data",body);
log.info("识别结果为:{}", body); log.info("识别结果为:{}", body);
ExtraVO result = originExtra.toJavaObject(ExtraVO.class); ExtraVO result = originExtra.toJavaObject(ExtraVO.class);
@ -55,7 +63,7 @@ public class ControlAnswerResolveServiceImpl implements IAnswerResolveService {
HashMap<String, String> param = new HashMap<>(1); HashMap<String, String> param = new HashMap<>(1);
param.put("itemName", params.getString("itemName")); param.put("itemName", params.getString("itemName"));
log.info("机器人巡检传参为:{}", JSON.toJSONString(param)); log.info("机器人巡检传参为:{}", JSON.toJSONString(param));
String body = HttpRequest.post("http://192.168.60.29:8080/api/hzinfo-inspect/plan/initiateRobotPlan").body(JSON.toJSONString(param)).execute().body(); String body = HttpRequest.post(initiateRobotPlanUrl).body(JSON.toJSONString(param)).execute().body();
log.info("结果为:{}",body); log.info("结果为:{}",body);
ExtraVO result = originExtra.toJavaObject(ExtraVO.class); ExtraVO result = originExtra.toJavaObject(ExtraVO.class);
result.setType(FunctionConstants.TypeEnum.PARAMS.getType()); result.setType(FunctionConstants.TypeEnum.PARAMS.getType());

3
hzims-service/gglm-big-model/src/main/resources/template/template.yml

@ -68,6 +68,9 @@ gglm:
insertVectors: "/vector/insert_vectors" insertVectors: "/vector/insert_vectors"
createTable: "/vector/create_table" createTable: "/vector/create_table"
deleteTable: "/vector/delete_table" deleteTable: "/vector/delete_table"
remote:
initiateRobotPlan: "http://${hzims.server.ip}/api/hzinfo-inspect/plan/initiateRobotPlan"
initiateVideoTask: "http://${hzims.server.ip}/api/hzinfo-inspect/feign/ai/analysisByStationId"
swagger: swagger:
base-packages: com.hnac.hzims.bigmodel base-packages: com.hnac.hzims.bigmodel

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -121,6 +121,9 @@ public class WorkTicketInfoServiceImpl extends ServiceImpl<WorkTicketInfoMapper,
private final IEmInfoClient emInfoClient; private final IEmInfoClient emInfoClient;
private final ISysClient sysClient; private final ISysClient sysClient;
@Value("${gglm.url_summary}")
private String summaryUrl;
/** /**
* 生成两票编号锁 * 生成两票编号锁
**/ **/
@ -1353,7 +1356,7 @@ public class WorkTicketInfoServiceImpl extends ServiceImpl<WorkTicketInfoMapper,
params.put("chat_id",chatId); params.put("chat_id",chatId);
params.put("q_id",queryId); params.put("q_id",queryId);
params.put("user_id",AuthUtil.getUserId().toString()); params.put("user_id",AuthUtil.getUserId().toString());
HttpRequest.post("http://192.168.60.16:9997/custom/device_ledger_summary").body(JSON.toJSONString(params)).execute(); HttpRequest.post(summaryUrl).body(JSON.toJSONString(params)).execute();
return chatId; return chatId;
} }
} }

3
hzims-service/ticket/src/main/resources/template/template.yml

@ -116,4 +116,7 @@ ticket:
- status: 12 - status: 12
flowId: sid-6358A80D-F592-4875-B281-A5B14A0EA39E flowId: sid-6358A80D-F592-4875-B281-A5B14A0EA39E
segment: 工作票延期 segment: 工作票延期
# 大模型获取设备台账总结url
gglm:
url_summary: "http://${gglm.host}:${gglm.port}/custom/device_ledger_summary"

3
hzims-service/ticket/src/test/resources/application-test.yml

@ -75,3 +75,6 @@ hzims:
first-work-flow-key: firstWorkTicket first-work-flow-key: firstWorkTicket
first-work-flow-key-new: newFirstWorkTicket first-work-flow-key-new: newFirstWorkTicket
app-config-business-key: ticket_invalid app-config-business-key: ticket_invalid
# 大模型获取设备台账总结url
gglm:
url_summary: "http://${gglm.host}:${gglm.port}/custom/device_ledger_summary"

Loading…
Cancel
Save