Browse Source

add:大模型,批量标注,问题提示

zhongwei
luyie 3 months ago
parent
commit
a1a739bef7
  1. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java
  2. 4
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java
  3. 24
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java
  4. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java
  5. 9
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java
  6. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java
  7. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

13
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/AgentLogController.java

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity; import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService; import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -21,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@Slf4j @Slf4j
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/label")
@Api(value = "问题标注", tags = "问题标注")
public class AgentLogController { public class AgentLogController {
private final AgentLogService agentLogService; private final AgentLogService agentLogService;
@ -41,7 +45,7 @@ public class AgentLogController {
@PostMapping("/save") @PostMapping("/save")
@ApiOperation(value = "保存") @ApiOperation(value = "保存")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
public R save(@RequestParam AgentLogEntity req) { public R save(@RequestBody AgentLogEntity req) {
return R.status(agentLogService.save(req)); return R.status(agentLogService.save(req));
} }
@ -58,4 +62,11 @@ public class AgentLogController {
public R update(@RequestBody AgentLogEntity req) { public R update(@RequestBody AgentLogEntity req) {
return R.status(agentLogService.updateById(req)); return R.status(agentLogService.updateById(req));
} }
@PutMapping("/batchLabel")
@ApiOperation(value = "批量标注")
@ApiOperationSupport(order = 6)
public R BatchLabel(@RequestBody IdsRequest ids) {
return R.status(agentLogService.BatchLabel(ids));
}
} }

4
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/controller/VectorParamController.java

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity; import com.hnac.hzims.bigmodel.maintenance.entity.VectorParamEntity;
import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService; import com.hnac.hzims.bigmodel.maintenance.service.VectorParamService;
import com.hnac.hzims.bigmodel.maintenance.vo.VectorSynchronizeRequest; import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import com.hnac.hzinfo.api.annotation.ApiInterface; import com.hnac.hzinfo.api.annotation.ApiInterface;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -112,7 +112,7 @@ public class VectorParamController {
@ApiOperation(value = "同步") @ApiOperation(value = "同步")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R synchronization(@RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken, public R synchronization(@RequestHeader(name = "Blade-Auth", value = "Blade-Auth", required = false) String bladeToken,
@RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @RequestBody VectorSynchronizeRequest req) throws JsonProcessingException { @RequestHeader(name = "Hzinfo-Auth", value = "Hzinfo-Auth", required = false) String hzinfoToken, @RequestBody IdsRequest req) throws JsonProcessingException {
return R.status(vectorParamService.synchronization(req.getIds(), bladeToken, hzinfoToken)); return R.status(vectorParamService.synchronization(req.getIds(), bladeToken, hzinfoToken));
} }
} }

24
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/entity/AgentLogEntity.java

@ -1,10 +1,13 @@
package com.hnac.hzims.bigmodel.maintenance.entity; package com.hnac.hzims.bigmodel.maintenance.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
@ -21,30 +24,51 @@ public class AgentLogEntity extends TenantEntity implements Serializable {
@ApiModelProperty("对话id") @ApiModelProperty("对话id")
@TableField("CHAT_ID") @TableField("CHAT_ID")
@QueryField(condition = SqlCondition.EQUAL)
private String chatId; private String chatId;
@ApiModelProperty("问题id") @ApiModelProperty("问题id")
@TableField("Q_ID") @TableField("Q_ID")
@QueryField(condition = SqlCondition.EQUAL)
private String qId; private String qId;
@ApiModelProperty("问题来源") @ApiModelProperty("问题来源")
@QueryField(condition = SqlCondition.EQUAL)
private String agent; private String agent;
@ApiModelProperty("问题") @ApiModelProperty("问题")
@QueryField(condition = SqlCondition.LIKE)
private String q; private String q;
@ApiModelProperty("问题提示")
@QueryField(condition = SqlCondition.LIKE)
@TableField("Q_HINT")
@JSONField(name = "qHint")
private String qHint;
@ApiModelProperty("答案") @ApiModelProperty("答案")
@QueryField(condition = SqlCondition.LIKE)
private String a; private String a;
@ApiModelProperty("答案类型") @ApiModelProperty("答案类型")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("A_TYPE")
@JSONField(name = "aType")
private String aType; private String aType;
@ApiModelProperty("用户结论,0为错误,1为正确") @ApiModelProperty("用户结论,0为错误,1为正确")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("USER_CONCLUSION")
private int userConclusion; private int userConclusion;
@ApiModelProperty("标注状态,0为未标注,1为已标注") @ApiModelProperty("标注状态,0为未标注,1为已标注")
@QueryField(condition = SqlCondition.EQUAL)
@TableField("LABEL_STATUS")
private int labelStatus; private int labelStatus;
@ApiModelProperty("标注内容,json字符串,答案类型不一样格式不一样") @ApiModelProperty("标注内容,json字符串,答案类型不一样格式不一样")
@QueryField(condition = SqlCondition.LIKE)
@TableField("LABEL_CONTENT")
private String labelContent; private String labelContent;
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/AgentLogService.java

@ -2,10 +2,12 @@ package com.hnac.hzims.bigmodel.maintenance.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity; import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
/** /**
* @Author: ypj * @Author: ypj
* @Date: 2024/9/9 11:08 * @Date: 2024/9/9 11:08
*/ */
public interface AgentLogService extends IService<AgentLogEntity> { public interface AgentLogService extends IService<AgentLogEntity> {
Boolean BatchLabel(IdsRequest ids);
} }

9
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/service/impl/AgentLogServiceImpl.java

@ -1,10 +1,12 @@
package com.hnac.hzims.bigmodel.maintenance.service.impl; package com.hnac.hzims.bigmodel.maintenance.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity; import com.hnac.hzims.bigmodel.maintenance.entity.AgentLogEntity;
import com.hnac.hzims.bigmodel.maintenance.mapper.AgentLogMapper; import com.hnac.hzims.bigmodel.maintenance.mapper.AgentLogMapper;
import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService; import com.hnac.hzims.bigmodel.maintenance.service.AgentLogService;
import com.hnac.hzims.bigmodel.maintenance.vo.IdsRequest;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -19,4 +21,11 @@ import org.springframework.stereotype.Service;
@DS("hznlm") @DS("hznlm")
public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService { public class AgentLogServiceImpl extends ServiceImpl<AgentLogMapper, AgentLogEntity> implements AgentLogService {
@Override
public Boolean BatchLabel(IdsRequest ids) {
return this.update(Wrappers.<AgentLogEntity>lambdaUpdate()
.set(AgentLogEntity::getLabelStatus, 1)
.in(AgentLogEntity::getId, ids.getIds()));
}
} }

2
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/VectorSynchronizeRequest.java → hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/maintenance/vo/IdsRequest.java

@ -9,7 +9,7 @@ import java.util.List;
* @Date: 2024/9/7 11:04 * @Date: 2024/9/7 11:04
*/ */
@Data @Data
public class VectorSynchronizeRequest { public class IdsRequest {
private List<Long> ids; private List<Long> ids;
} }

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -875,23 +875,34 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
if (ObjectUtil.isEmpty(entity)) { if (ObjectUtil.isEmpty(entity)) {
throw new HzServiceException("未查询到月报信息!"); throw new HzServiceException("未查询到月报信息!");
} }
String analyseResult = entity.getAnalyseResult();
Map<String, Object> analyseResultMap = new HashMap<>();
if (StringUtil.isNotBlank(analyseResult)) {
analyseResultMap = JsonUtil.toMap(analyseResult);
}
String conclusion = entity.getConclusion(); String conclusion = entity.getConclusion();
Map<String, Object> conclusionMap = new HashMap<>(); Map<String, Object> conclusionMap = new HashMap<>();
if (StringUtil.isNotBlank(conclusion)) { if (StringUtil.isNotBlank(conclusion)) {
conclusionMap = JsonUtil.toMap(conclusion); conclusionMap = JsonUtil.toMap(conclusion);
} }
String evaluation = entity.getEvaluation(); String evaluation = entity.getEvaluation();
Map<String, Object> evaluationMap = new HashMap<>(); Map<String, Object> evaluationMap = new HashMap<>();
if (StringUtil.isNotBlank(evaluation)) { if (StringUtil.isNotBlank(evaluation)) {
evaluationMap = JsonUtil.toMap(evaluation); evaluationMap = JsonUtil.toMap(evaluation);
} }
// 更新
if (StringUtil.isNotBlank(req.getContent())) { if (StringUtil.isNotBlank(req.getContent())) {
conclusionMap.put(req.getType(), req.getContent()); conclusionMap.put(req.getType(), req.getContent());
analyseResultMap.put(req.getType(), req.getContent());
} }
if (StringUtil.isNotBlank(req.getEvaluation())) { if (StringUtil.isNotBlank(req.getEvaluation())) {
evaluationMap.put(req.getType(), req.getEvaluation()); evaluationMap.put(req.getType(), req.getEvaluation());
} }
return this.update(Wrappers.<RunMonthEntity>lambdaUpdate() return this.update(Wrappers.<RunMonthEntity>lambdaUpdate()
.set(RunMonthEntity::getAnalyseResult, JsonUtil.toJson(analyseResultMap))
.set(RunMonthEntity::getConclusion, JsonUtil.toJson(conclusionMap)) .set(RunMonthEntity::getConclusion, JsonUtil.toJson(conclusionMap))
.set(RunMonthEntity::getEvaluation, JsonUtil.toJson(evaluationMap)) .set(RunMonthEntity::getEvaluation, JsonUtil.toJson(evaluationMap))
.eq(RunMonthEntity::getId, req.getId())); .eq(RunMonthEntity::getId, req.getId()));

Loading…
Cancel
Save