This commit is contained in:
jack ning
2025-11-24 11:37:01 +08:00
parent b8ee1d591d
commit f8ea6efed2
3 changed files with 10 additions and 10 deletions

View File

@@ -284,8 +284,8 @@ public class AgentThreadRoutingStrategy extends AbstractThreadRoutingStrategy {
log.debug("获取最新线程状态并更新为聊天状态");
ThreadEntity thread = getThreadByUid(threadFromRequest.getUid());
String tip = getAgentWelcomeMessage(agent);
WelcomeContent wc = WelcomeContentUtils.buildAgentWelcomeContent(agent, tip);
String jsonWelcome = wc != null ? wc.toJson() : null;
WelcomeContent welcomeContent = WelcomeContentUtils.buildAgentWelcomeContent(agent, tip);
String jsonWelcome = welcomeContent != null ? welcomeContent.toJson() : null;
thread.setChatting().setContent(jsonWelcome);
log.debug("线程状态更新完成 - 状态: {}, 欢迎消息长度: {}",
thread.getStatus(), jsonWelcome != null ? jsonWelcome.length() : 0);
@@ -309,7 +309,7 @@ public class AgentThreadRoutingStrategy extends AbstractThreadRoutingStrategy {
// 发送欢迎消息
log.debug("开始发送欢迎消息");
long msgStartTime = System.currentTimeMillis();
MessageProtobuf messageProtobuf = ThreadMessageUtil.getThreadWelcomeMessage(wc, savedThread);
MessageProtobuf messageProtobuf = ThreadMessageUtil.getThreadWelcomeMessage(welcomeContent, savedThread);
messageSendService.sendProtobufMessage(messageProtobuf);
log.info("可用客服处理完成 - threadUid: {}, agentUid: {}, 消息发送耗时: {}ms, 总处理耗时: {}ms",
savedThread.getUid(), agent.getUid(), System.currentTimeMillis() - msgStartTime,

View File

@@ -179,8 +179,8 @@ public class RobotThreadRoutingStrategy extends AbstractThreadRoutingStrategy {
// 2. 配置线程状态
String tip = getRobotWelcomeMessage(robotEntity);
WelcomeContent wc = WelcomeContentUtils.buildRobotWelcomeContent(robotEntity, tip);
thread.setRoboting().setContent(wc != null ? wc.toJson() : null);
WelcomeContent welcomeContent = WelcomeContentUtils.buildRobotWelcomeContent(robotEntity, tip);
thread.setRoboting().setContent(welcomeContent != null ? welcomeContent.toJson() : null);
// 3. 设置机器人信息
String robotString = ConvertAiUtils.convertToRobotProtobufString(robotEntity);
@@ -196,7 +196,7 @@ public class RobotThreadRoutingStrategy extends AbstractThreadRoutingStrategy {
publishRobotThreadEvent(savedThread);
// 7. 创建并保存欢迎消息
return createAndSaveWelcomeMessage(wc, savedThread);
return createAndSaveWelcomeMessage(welcomeContent, savedThread);
}
/**

View File

@@ -497,9 +497,9 @@ public class WorkgroupThreadRoutingStrategy extends AbstractThreadRoutingStrateg
ThreadEntity thread = getThreadByUid(threadFromRequest.getUid());
// 设置欢迎内容和线程状态
String welcomeContent = getAgentWelcomeMessage(agentEntity);
String welcomeTip = getAgentWelcomeMessage(agentEntity);
thread.setUserUid(agentEntity.getUid());
thread.setChatting().setContent(welcomeContent);
thread.setChatting().setContent(welcomeTip);
// 设置线程所有者
setThreadOwner(thread, agentEntity);
@@ -518,8 +518,8 @@ public class WorkgroupThreadRoutingStrategy extends AbstractThreadRoutingStrateg
publishWorkgroupThreadEvents(savedThread);
// 发送欢迎消息(结构化 WelcomeContent
WelcomeContent wc = WelcomeContentUtils.buildAgentWelcomeContent(agentEntity);
MessageProtobuf messageProtobuf = ThreadMessageUtil.getThreadWelcomeMessage(wc, savedThread);
WelcomeContent welcomeContent = WelcomeContentUtils.buildAgentWelcomeContent(agentEntity);
MessageProtobuf messageProtobuf = ThreadMessageUtil.getThreadWelcomeMessage(welcomeContent, savedThread);
messageSendService.sendProtobufMessage(messageProtobuf);
return messageProtobuf;