feat: AI消息点赞/踩/取消点赞/取消踩/问题反馈信息保存功能完善

This commit is contained in:
郭诚奇
2025-12-04 14:25:39 +08:00
parent ee0a853b1b
commit b9fc27f4fb
4 changed files with 71 additions and 53 deletions

View File

@@ -89,6 +89,7 @@ public class CaseAiChatApi extends ApiBaseController {
@PostMapping("/likeMsg") @PostMapping("/likeMsg")
public JsonResponse<Boolean> likeMsg(@RequestBody CaseAiMsgLikeDto caseAiMsgLikeDto) { public JsonResponse<Boolean> likeMsg(@RequestBody CaseAiMsgLikeDto caseAiMsgLikeDto) {
try { try {
caseAiMsgLikeDto.setOperation(true);
if (caseAiChatService.msgFeedback(caseAiMsgLikeDto)) { if (caseAiChatService.msgFeedback(caseAiMsgLikeDto)) {
return success(true, "保存成功"); return success(true, "保存成功");
} else { } else {
@@ -109,6 +110,7 @@ public class CaseAiChatApi extends ApiBaseController {
@PostMapping("/msgFeedback") @PostMapping("/msgFeedback")
public JsonResponse<Boolean> msgFeedback(@RequestBody CaseAiMsgLikeDto caseAiMsgLikeDto) { public JsonResponse<Boolean> msgFeedback(@RequestBody CaseAiMsgLikeDto caseAiMsgLikeDto) {
try { try {
caseAiMsgLikeDto.setOperation(false);
if (caseAiChatService.msgFeedback(caseAiMsgLikeDto)) { if (caseAiChatService.msgFeedback(caseAiMsgLikeDto)) {
return success(true, "保存成功"); return success(true, "保存成功");
} else { } else {

View File

@@ -21,4 +21,12 @@ public class CaseAiMsgLikeDto {
* 反馈 * 反馈
*/ */
private String feedback; private String feedback;
/**
* 操作
* true: 点踩
* false: 反馈
* 为空:其他情况
*/
private Boolean operation;
} }

View File

@@ -810,10 +810,18 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
log.error("操作失败docId为空"); log.error("操作失败docId为空");
return false; return false;
} }
if ((StringUtils.equalsAny(caseAiMsgLikeDto.getLikeStatus(), "0", "1", "-1")) || StringUtils.isBlank(caseAiMsgLikeDto.getFeedback())) { if (Boolean.TRUE.equals(caseAiMsgLikeDto.getOperation())) {
String likeStatus = caseAiMsgLikeDto.getLikeStatus();
if (!StringUtils.equals(likeStatus, "1") && !StringUtils.equals(likeStatus, "0") && !StringUtils.equals(likeStatus, "-1")) {
log.error("操作失败,参数错误"); log.error("操作失败,参数错误");
return false; return false;
} }
} else if (Boolean.FALSE.equals(caseAiMsgLikeDto.getOperation())) {
if (StringUtils.isBlank(caseAiMsgLikeDto.getFeedback())) {
log.error("操作失败,参数错误");
return false;
}
}
aiChatConversationData.setLikeStatus(caseAiMsgLikeDto.getLikeStatus()); aiChatConversationData.setLikeStatus(caseAiMsgLikeDto.getLikeStatus());
aiChatConversationData.setFeedback(caseAiMsgLikeDto.getFeedback()); aiChatConversationData.setFeedback(caseAiMsgLikeDto.getFeedback());
return elasticSearchIndexService.updateData(caseAiMsgLikeDto.getDocId() ,aiChatConversationData); return elasticSearchIndexService.updateData(caseAiMsgLikeDto.getDocId() ,aiChatConversationData);

View File

@@ -11,22 +11,22 @@ spring:
cloud: cloud:
nacos: nacos:
discovery: discovery:
server-addr: 192.168.0.253:8848 server-addr: 192.168.10.74:8848
config: config:
server-addr: 192.168.0.253:8848 server-addr: 192.168.10.74:8848
redis: redis:
database: 1 database: 2
host: 192.168.0.253 host: 39.104.123.58
password: boe@123 password: Ebiz2020
port: 6379 port: 6378
jpa: jpa:
hibernate: hibernate:
ddl-auto: none ddl-auto: none
datasource: datasource:
driverClassName: com.mysql.jdbc.Driver driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.0.253:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull url: jdbc:mysql://rm-hp3cpkk0u50q90eu9vo.mysql.huhehaote.rds.aliyuncs.com:3306/ebiz_doc_manage?characterEncoding=utf8&useUnicode=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true
username: root username: ebiz_ai
password: boe#1234A password: ebiz_ai123
type: com.zaxxer.hikari.HikariDataSource type: com.zaxxer.hikari.HikariDataSource
hikari: hikari:
auto-commit: true auto-commit: true
@@ -36,7 +36,7 @@ spring:
max-lifetime: 1800000 max-lifetime: 1800000
maximum-pool-size: 20 maximum-pool-size: 20
activemq: activemq:
broker-url: tcp://192.168.0.253:61616 broker-url: tcp://192.168.10.74:61616
user: admin user: admin
password: admin password: admin
jms: jms:
@@ -113,7 +113,7 @@ aop-log-record:
#不进行拦截的包或者类 #不进行拦截的包或者类
excludeClassNames: excludeClassNames:
activemq: activemq:
broker-url: tcp://192.168.0.253:61616 broker-url: tcp://192.168.10.74:61616
user: admin user: admin
password: admin password: admin
elasticsearch: elasticsearch: