This commit is contained in:
jack ning
2025-06-16 12:09:17 +08:00
parent 9513bc9cf0
commit 930a6820d2
2 changed files with 144 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-02-21 10:01:27
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-05-19 11:18:42
* @LastEditTime: 2025-06-16 11:41:24
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -56,14 +56,74 @@ public class ThreadProtobuf implements Serializable {
return JSON.toJSONString(this);
}
public Boolean isCustomerService() {
return ThreadTypeEnum.AGENT.equals(type) || ThreadTypeEnum.WORKGROUP.equals(type);
}
public Boolean isMember() {
return ThreadTypeEnum.MEMBER.equals(type);
}
public Boolean isNew() {
return getStatus().equals(ThreadProcessStatusEnum.NEW);
}
// ROBOTING
public Boolean isRoboting() {
return getStatus().equals(ThreadProcessStatusEnum.ROBOTING);
}
// LLMING
public Boolean isLlmIng() {
return getStatus().equals(ThreadProcessStatusEnum.LLMING);
}
// queuing
public Boolean isQueuing() {
return getStatus().equals(ThreadProcessStatusEnum.QUEUING);
}
// is offline
public Boolean isOffline() {
return getStatus().equals(ThreadProcessStatusEnum.OFFLINE);
}
public Boolean isChatting() {
return getStatus().equals(ThreadProcessStatusEnum.CHATTING);
}
//
public Boolean isClosed() {
return getStatus().equals(ThreadProcessStatusEnum.CLOSED);
}
public Boolean isCustomerService() {
return getType().equals(ThreadTypeEnum.AGENT)
|| getType().equals(ThreadTypeEnum.WORKGROUP)
|| getType().equals(ThreadTypeEnum.ROBOT)
|| getType().equals(ThreadTypeEnum.UNIFIED);
}
public Boolean isRobotType() {
return getType().equals(ThreadTypeEnum.ROBOT);
}
public Boolean isWorkgroupType() {
return getType().equals(ThreadTypeEnum.WORKGROUP);
}
public Boolean isAgentType() {
return getType().equals(ThreadTypeEnum.AGENT);
}
public Boolean isUnifiedType() {
return getType().equals(ThreadTypeEnum.UNIFIED);
}
public Boolean isWeChatMp() {
return getClient().equals(ClientEnum.WECHAT_MP);
}
public Boolean isWeChatMini() {
return getClient().equals(ClientEnum.WECHAT_MINI);
}
// public static ThreadProtobuf fromEntity(ThreadEntity thread) {
// return ThreadProtobuf.builder()
// .uid(thread.getUid())

View File

@@ -0,0 +1,79 @@
/*
* @Author: jackning 270580156@qq.com
* @Date: 2025-05-22 10:00:00
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-06-16 11:57:49
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
* contact: 270580156@qq.com
* 联系270580156@qq.com
* Copyright (c) 2025 by bytedesk.com, All Rights Reserved.
*/
package com.bytedesk.core.utils;
import java.util.Arrays;
import java.util.List;
import org.springframework.util.StringUtils;
/**
* 转人工关键词检测工具类
*/
public class TransferKeywordUtil {
/**
* 转人工相关关键词列表
*/
private static final List<String> TRANSFER_KEYWORDS = Arrays.asList(
"转人工",
"人工客服",
"真人客服",
"人工服务",
"真人服务",
"转接人工",
"转接客服",
"真人",
"人工",
"客服",
"转接",
"转人",
"人工解答",
"找人工",
"接通人工",
"需要人工",
"联系人工",
"人工帮助",
"不想机器人",
"机器人没用",
"换人工",
"换客服",
"真人咨询",
"真实客服",
"真人解答",
"需要真人",
"人工处理",
"专员服务");
/**
* 检查文本是否包含转人工关键词
*
* @param text 待检查的文本内容
* @return 如果包含关键词返回true否则返回false
*/
public static boolean containsTransferKeyword(String text) {
if (!StringUtils.hasText(text)) {
return false;
}
String lowerText = text.toLowerCase();
for (String keyword : TRANSFER_KEYWORDS) {
if (lowerText.contains(keyword)) {
return true;
}
}
return false;
}
}