mirror of
https://github.com/chatopera/cosin.git
synced 2025-06-16 18:30:03 +08:00
Block montoring api in nginx, enable chatbot only mode, fix contacts modifications
This commit is contained in:
parent
d84fb8be4c
commit
38ce01bc8f
@ -190,7 +190,8 @@ public class Constants {
|
||||
public static final HashSet<String> CHATBOT_VALID_LANGS = new HashSet<String>(Arrays.asList("zh_CN", "en_US"));
|
||||
public static final String CHATBOT_CHATBOT_FIRST = "机器人客服优先";
|
||||
public static final String CHATBOT_HUMAN_FIRST = "人工客服优先";
|
||||
public static final HashSet<String> CHATBOT_VALID_WORKMODELS = new HashSet<String>(Arrays.asList(CHATBOT_CHATBOT_FIRST, CHATBOT_HUMAN_FIRST));
|
||||
public static final String CHATBOT_CHATBOT_ONLY = "仅机器人客服";
|
||||
public static final HashSet<String> CHATBOT_VALID_WORKMODELS = new HashSet<String>(Arrays.asList(CHATBOT_CHATBOT_FIRST, CHATBOT_HUMAN_FIRST, CHATBOT_CHATBOT_ONLY));
|
||||
|
||||
|
||||
}
|
||||
|
@ -252,8 +252,6 @@ public class AppsController extends Handler {
|
||||
if (logined.isAdmin()) {
|
||||
// 作为管理员,强制设置为坐席
|
||||
tempUser.setAgent(true);
|
||||
} else {
|
||||
tempUser.setAgent(user.isAgent());
|
||||
}
|
||||
|
||||
tempUser.setOrgi(super.getOrgiByTenantshare(request));
|
||||
|
@ -136,6 +136,8 @@ public class IMController extends Handler {
|
||||
@Autowired
|
||||
private UserHistoryRepository userHistoryRes;
|
||||
|
||||
@Autowired
|
||||
private ChatbotRepository chatbotRes;
|
||||
|
||||
@Autowired
|
||||
private Cache cache;
|
||||
@ -560,7 +562,9 @@ public class IMController extends Handler {
|
||||
@Valid final String pid,
|
||||
@Valid final String purl,
|
||||
@Valid final boolean isInvite) throws Exception {
|
||||
logger.info("[index] orgi {}, skill {}, agent {}, traceid {}, isInvite {}", orgi, skill, agent, traceid, isInvite);
|
||||
logger.info(
|
||||
"[index] orgi {}, skill {}, agent {}, traceid {}, isInvite {}, exchange {}", orgi, skill, agent,
|
||||
traceid, isInvite, exchange);
|
||||
Map<String, String> sessionMessageObj = cache.findOneSystemMapByIdAndOrgi(sessionid, orgi);
|
||||
|
||||
if (sessionMessageObj != null) {
|
||||
@ -660,12 +664,12 @@ public class IMController extends Handler {
|
||||
}
|
||||
|
||||
AgentReport report;
|
||||
|
||||
if (invite.isSkill() && invite.isConsult_skill_fixed()) { // 绑定技能组
|
||||
report = acdWorkMonitor.getAgentReport(invite.getConsult_skill_fixed_id(), invite.getOrgi());
|
||||
} else {
|
||||
report = acdWorkMonitor.getAgentReport(invite.getOrgi());
|
||||
}
|
||||
|
||||
boolean isLeavemsg = false;
|
||||
if (report.getAgents() == 0 ||
|
||||
(sessionConfig.isHourcheck() &&
|
||||
@ -768,7 +772,8 @@ public class IMController extends Handler {
|
||||
String cid = (String) request.getSession().getAttribute("Sessioncid");
|
||||
|
||||
if (StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(cid)) {
|
||||
Contacts contacts1 = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(uid, sid, cid, false);
|
||||
Contacts contacts1 = contactsRes.findOneByWluidAndWlsidAndWlcidAndDatastatus(
|
||||
uid, sid, cid, false);
|
||||
if (contacts1 != null) {
|
||||
agentUserRepository.findOneByUseridAndOrgi(userid, orgi).ifPresent(p -> {
|
||||
// 关联AgentService的联系人
|
||||
@ -828,17 +833,23 @@ public class IMController extends Handler {
|
||||
map.addAttribute("username", nickname);
|
||||
|
||||
// 是否使用机器人客服
|
||||
Chatbot bot = null;
|
||||
if (MainContext.hasModule(Constants.CSKEFU_MODULE_CHATBOT) &&
|
||||
StringUtils.isNotBlank(invite.getAiid()) &&
|
||||
invite.isAi() &&
|
||||
((bot = chatbotRes.findOne(invite.getAiid())) != null) &&
|
||||
((StringUtils.equals(
|
||||
ai, "true")) || (invite.isAifirst() && ai == null))) { //启用 AI , 并且 AI优先 接待
|
||||
|
||||
HashMap<String, String> chatbotConfig = new HashMap<String, String>();
|
||||
chatbotConfig.put("botname", invite.getAiname());
|
||||
chatbotConfig.put("botid", invite.getAiid());
|
||||
chatbotConfig.put("botwelcome", invite.getAimsg());
|
||||
chatbotConfig.put("botfirst", Boolean.toString(invite.isAifirst()));
|
||||
chatbotConfig.put("isai", Boolean.toString(invite.isAi()));
|
||||
map.addAttribute(
|
||||
"exchange", !StringUtils.equals(bot.getWorkmode(), Constants.CHATBOT_CHATBOT_ONLY));
|
||||
|
||||
if (chatbotConfig != null) {
|
||||
map.addAttribute("chatbotConfig", chatbotConfig);
|
||||
}
|
||||
@ -848,7 +859,8 @@ public class IMController extends Handler {
|
||||
"/apps/im/chatbot/mobile")); // 智能机器人 移动端
|
||||
}
|
||||
} else {
|
||||
if (!isLeavemsg && (MobileDevice.isMobile(request.getHeader("User-Agent")) || StringUtils.isNotBlank(mobile))) {
|
||||
if (!isLeavemsg && (MobileDevice.isMobile(
|
||||
request.getHeader("User-Agent")) || StringUtils.isNotBlank(mobile))) {
|
||||
view = request(
|
||||
super.createRequestPageTempletResponse("/apps/im/mobile")); // WebIM移动端。再次点选技能组?
|
||||
}
|
||||
|
@ -79,7 +79,7 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="phone" lay-verify="entphone" autocomplete="off"
|
||||
<input type="text" name="phone" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
@ -87,7 +87,7 @@
|
||||
<div class="layui-inline uckefu-inline">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobileno" id="getdate" lay-verify="entphone" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="mobileno" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -159,11 +159,6 @@
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
|
@ -93,14 +93,14 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="phone" lay-verify="entphone" value="${contacts.phone!''}" autocomplete="off"
|
||||
<input type="text" name="phone" value="${contacts.phone!''}" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline uckefu-inline">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobileno" id="getdate" lay-verify="entphone" value="${contacts.mobileno!''}" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="mobileno" value="${contacts.mobileno!''}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -172,11 +172,6 @@
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
|
@ -81,14 +81,14 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="phone" lay-verify="entphone" autocomplete="off"
|
||||
<input type="text" name="phone" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline uckefu-inline">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobileno" id="getdate" lay-verify="entphone" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="mobileno" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -161,11 +161,6 @@
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
|
@ -86,14 +86,14 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="phone" lay-verify="entphone" value="${contacts.phone!''}" autocomplete="off"
|
||||
<input type="text" name="phone" value="${contacts.phone!''}" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline uckefu-inline">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mobileno" id="getdate" lay-verify="entphone" value="${contacts.mobileno!''}" autocomplete="off" class="layui-input">
|
||||
<input type="text" name="mobileno" value="${contacts.mobileno!''}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -166,11 +166,6 @@
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
|
@ -62,7 +62,7 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="entcustomer.phone" lay-verify="entphone" autocomplete="off"
|
||||
<input type="text" name="entcustomer.phone" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
@ -187,7 +187,7 @@
|
||||
<label class="layui-form-label">座机电话:</label>
|
||||
<div class="layui-input-inline" style="width:auto;">
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="contacts.phone" autocomplete="off" class="layui-input" lay-verify="landlinephone">
|
||||
<input type="text" name="contacts.phone" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -204,7 +204,7 @@
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline" style="width:auto;">
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="contacts.mobile" autocomplete="off" class="layui-input" lay-verify="entphone">
|
||||
<input type="text" name="contacts.mobile" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -233,28 +233,15 @@
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
$('#entcustomer_province').change(function(){
|
||||
loadURL('/res/dic.html?id='+$(this).val()+"&name=entcustomer.city&attr=lay-ignore&style=width:85px;" , '#entcustomer_city');
|
||||
})
|
||||
layui.use('form', function() {
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
}
|
||||
},
|
||||
landlinephone: function(value){
|
||||
if(value!="" && !new RegExp(/^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
customer_username: function (value) {
|
||||
if (value.length > 100){
|
||||
return "用户姓名不能超过100字";
|
||||
@ -294,4 +281,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
$('#entcustomer_province').change(function(){
|
||||
loadURL('/res/dic.html?id='+$(this).val()+"&name=entcustomer.city&attr=lay-ignore&style=width:85px;" , '#entcustomer_city');
|
||||
})
|
||||
</script>
|
||||
|
@ -64,7 +64,7 @@
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">联系电话:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="entcustomer.phone" lay-verify="entphone" autocomplete="off" value="${entCustomer.phone!''}"
|
||||
<input type="text" name="entcustomer.phone" autocomplete="off" value="${entCustomer.phone!''}"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
@ -174,11 +174,6 @@
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
entphone: function(value){
|
||||
if(value!="" && !new RegExp(/^(0\d{2,3}-{0,1}\d{5,8}(-{0,1}\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\d{8})$/).test(value)){
|
||||
return '请输入正确的电话号码';
|
||||
}
|
||||
},
|
||||
entemail: function(value){
|
||||
if(value!="" && !new RegExp(/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/).test(value)){
|
||||
return '请输入正确的电子邮箱地址';
|
||||
|
@ -17,7 +17,13 @@ server {
|
||||
proxy_pass http://contact-center:8035;
|
||||
}
|
||||
|
||||
location /socket.io { proxy_set_header Upgrade $http_upgrade;
|
||||
location /actuator {
|
||||
return 403 "403: Target API is blocked.";
|
||||
|
||||
}
|
||||
|
||||
location /socket.io {
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
|
@ -267,7 +267,7 @@ public class ApiChatbotController extends Handler {
|
||||
|
||||
if (j.has("workmode") && Constants.CHATBOT_VALID_WORKMODELS.contains(j.get("workmode").getAsString())) {
|
||||
c.setWorkmode(j.get("workmode").getAsString());
|
||||
invite.setAifirst(StringUtils.equals(Constants.CHATBOT_CHATBOT_FIRST, c.getWorkmode()));
|
||||
invite.setAifirst(!StringUtils.equals(Constants.CHATBOT_HUMAN_FIRST, c.getWorkmode()));
|
||||
}
|
||||
|
||||
if (j.has("enabled")) {
|
||||
|
@ -52,6 +52,7 @@
|
||||
<select name="workmode" lay-verify="required">
|
||||
<option <#if bot.workmode=="机器人客服优先">selected="selected"</#if>>机器人客服优先</option>
|
||||
<option <#if bot.workmode=="人工客服优先">selected="selected"</#if>>人工客服优先</option>
|
||||
<option <#if bot.workmode=="仅机器人客服">selected="selected"</#if>>仅机器人客服</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">来自访客的会话默认以什么方式接待</div>
|
||||
|
@ -118,7 +118,7 @@
|
||||
<td>
|
||||
${currentbot.workmode}
|
||||
</td>
|
||||
<td><p style="color: #9C9C9C">工作模式有机器人优先和人工坐席优先两种,这决定了访客连线后默认对接的方式。</p></td>
|
||||
<td><p style="color: #9C9C9C">工作模式有"机器人优先","人工坐席优先"和"仅机器人客服"三种,这决定了访客连线后默认对接的方式。</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user