Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qiangwayu9962
cskefu
提交
830d5760
C
cskefu
项目概览
qiangwayu9962
/
cskefu
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cskefu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
830d5760
编写于
12月 10, 2020
作者:
Chatopera 研发团队
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
https://github.com/chatopera/cskefu/issues/384
update codes for cskefu.com
上级
88b1b92c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
67 addition
and
51 deletion
+67
-51
contact-center/app/pom.xml
contact-center/app/pom.xml
+14
-14
contact-center/root/pom.xml
contact-center/root/pom.xml
+11
-11
public/plugins/chatbot/classes/ApiChatbotController.java
public/plugins/chatbot/classes/ApiChatbotController.java
+31
-21
public/plugins/chatbot/classes/ChatbotEventHandler.java
public/plugins/chatbot/classes/ChatbotEventHandler.java
+11
-5
未找到文件。
contact-center/app/pom.xml
浏览文件 @
830d5760
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.chatopera.cc
</groupId>
<artifactId>
contact-center
</artifactId>
...
...
@@ -17,17 +17,17 @@
<build>
<finalName>
contact-center
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
...
...
@@ -118,7 +118,7 @@
<repository>
<id>
chatopera
</id>
<name>
Chatopera Inc.
</name>
<url>
https://nexus.c
hatopera
.com/repository/maven-public/
</url>
<url>
https://nexus.c
skefu
.com/repository/maven-public/
</url>
<releases>
<enabled>
true
</enabled>
</releases>
...
...
contact-center/root/pom.xml
浏览文件 @
830d5760
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.chatopera.cc
</groupId>
<artifactId>
cc-root
</artifactId>
...
...
@@ -245,11 +245,11 @@
<version>
2.6.0
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
25.1-jre
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
25.1-jre
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>
com.google.code.gson
</groupId>
...
...
@@ -379,14 +379,14 @@
<dependency>
<groupId>
com.chatopera.bot
</groupId>
<artifactId>
sdk
</artifactId>
<version>
3.
1.0
</version>
<version>
3.
3.1
</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>
chatopera
</id>
<name>
Chatopera Inc.
</name>
<url>
https://nexus.c
hatopera
.com/repository/maven-public
</url>
<url>
https://nexus.c
skefu
.com/repository/maven-public
</url>
<releases>
<enabled>
true
</enabled>
</releases>
...
...
@@ -400,12 +400,12 @@
<repository>
<id>
chatopera-releases
</id>
<name>
Chatopera Nexus Releases
</name>
<url>
https://nexus.c
hatopera
.com/repository/maven-releases/
</url>
<url>
https://nexus.c
skefu
.com/repository/maven-releases/
</url>
</repository>
<snapshotRepository>
<id>
chatopera-snapshots
</id>
<name>
Chatopera Nexus Snapshots
</name>
<url>
https://nexus.c
hatopera
.com/repository/maven-snapshots/
</url>
<url>
https://nexus.c
skefu
.com/repository/maven-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
...
...
public/plugins/chatbot/classes/ApiChatbotController.java
浏览文件 @
830d5760
...
...
@@ -16,6 +16,7 @@
package
com.chatopera.cc.plugins.chatbot
;
import
com.chatopera.bot.exception.ChatbotException
;
import
com.chatopera.bot.sdk.Response
;
import
com.chatopera.cc.basic.Constants
;
import
com.chatopera.cc.basic.MainUtils
;
import
com.chatopera.cc.controller.Handler
;
...
...
@@ -205,7 +206,9 @@ public class ApiChatbotController extends Handler {
try
{
com
.
chatopera
.
bot
.
sdk
.
Chatbot
bot
=
new
com
.
chatopera
.
bot
.
sdk
.
Chatbot
(
c
.
getClientId
(),
c
.
getSecret
(),
botServiecProvider
);
if
(
bot
.
exists
())
{
Response
result
=
bot
.
command
(
"GET"
,
"/"
);
if
(
result
.
getRc
()
==
0
)
{
c
.
setEnabled
(
isEnabled
);
chatbotRes
.
save
(
c
);
...
...
@@ -327,24 +330,28 @@ public class ApiChatbotController extends Handler {
try
{
com
.
chatopera
.
bot
.
sdk
.
Chatbot
bot
=
new
com
.
chatopera
.
bot
.
sdk
.
Chatbot
(
c
.
getClientId
(),
c
.
getSecret
(),
botServiecProvider
);
if
(
bot
.
exists
())
{
Response
result
=
bot
.
command
(
"GET"
,
"/"
);
logger
.
info
(
"[update] bot details response {}"
,
result
.
toJSON
().
toString
());
if
(
result
.
getRc
()
==
0
)
{
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_SUCC
);
JsonObject
data
=
new
JsonObject
();
data
.
addProperty
(
"id"
,
c
.
getId
());
resp
.
add
(
RestUtils
.
RESP_KEY_DATA
,
data
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_MSG
,
"更新成功。"
);
JSONObject
botDetails
=
bot
.
details
();
c
.
setDescription
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"description"
));
c
.
setFallback
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"fallback"
));
c
.
setWelcome
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"welcome"
));
invite
.
setAisuccesstip
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"welcome"
));
c
.
setName
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"name"
));
JSONObject
botDetails
=
(
JSONObject
)
result
.
getData
();
c
.
setDescription
(
botDetails
.
getString
(
"description"
));
c
.
setFallback
(
botDetails
.
getString
(
"fallback"
));
c
.
setWelcome
(
botDetails
.
getString
(
"welcome"
));
invite
.
setAisuccesstip
(
botDetails
.
getString
(
"welcome"
));
c
.
setName
(
botDetails
.
getString
(
"name"
));
invite
.
setAiname
(
c
.
getName
());
}
else
{
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_FAIL_6
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。提示:该机器人不存在,请先创建机器人, 登录 https://bot.chatopera.com"
);
"Chatopera
云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。提示:该机器人不存在,请先创建机器人, 登录 https://bot.chatopera.com"
);
return
resp
;
}
}
catch
(
ChatbotException
e
)
{
...
...
@@ -352,7 +359,7 @@ public class ApiChatbotController extends Handler {
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_FAIL_5
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。"
);
"Chatopera
云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。"
);
return
resp
;
}
catch
(
MalformedURLException
e
)
{
logger
.
error
(
"bot request error"
,
e
);
...
...
@@ -541,22 +548,25 @@ public class ApiChatbotController extends Handler {
}
try
{
logger
.
info
(
"
create
bot with url {}"
,
botServiecProvider
);
logger
.
info
(
"
[create]
bot with url {}"
,
botServiecProvider
);
com
.
chatopera
.
bot
.
sdk
.
Chatbot
bot
=
new
com
.
chatopera
.
bot
.
sdk
.
Chatbot
(
clientId
,
secret
,
botServiecProvider
);
if
(
bot
.
exists
())
{
// 该机器人存在,clientId 和 Secret配对成功
Response
result
=
bot
.
command
(
"GET"
,
"/"
);
logger
.
info
(
"[create] bot details response {}"
,
result
.
toJSON
().
toString
());
if
(
result
.
getRc
()
==
0
)
{
// 该机器人存在,clientId 和 Secret配对成功
// 创建成功
Chatbot
c
=
new
Chatbot
();
JSONObject
botDetails
=
bot
.
details
();
JSONObject
botDetails
=
(
JSONObject
)
result
.
getData
();
c
.
setId
(
MainUtils
.
getUUID
());
c
.
setClientId
(
clientId
);
c
.
setSecret
(
secret
);
c
.
setBaseUrl
(
botServiecProvider
);
c
.
setDescription
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"description"
));
c
.
setFallback
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"fallback"
));
c
.
setPrimaryLanguage
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"primaryLanguage"
));
c
.
setName
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"name"
));
c
.
setWelcome
(
botDetails
.
get
JSONObject
(
"data"
).
get
String
(
"welcome"
));
c
.
setDescription
(
botDetails
.
getString
(
"description"
));
c
.
setFallback
(
botDetails
.
getString
(
"fallback"
));
c
.
setPrimaryLanguage
(
botDetails
.
getString
(
"primaryLanguage"
));
c
.
setName
(
botDetails
.
getString
(
"name"
));
c
.
setWelcome
(
botDetails
.
getString
(
"welcome"
));
c
.
setCreater
(
creater
);
c
.
setOrgi
(
orgi
);
c
.
setChannel
(
Constants
.
CHANNEL_TYPE_WEBIM
);
...
...
@@ -590,7 +600,7 @@ public class ApiChatbotController extends Handler {
// 创建失败
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_FAIL_6
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera云服务:该机器人不存在,请先创建机器人, 登录 https://bot.chatopera.com"
);
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera
云服务:该机器人不存在,请先创建机器人, 登录 https://bot.chatopera.com"
);
return
resp
;
}
}
catch
(
ChatbotException
e
)
{
...
...
@@ -598,12 +608,12 @@ public class ApiChatbotController extends Handler {
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_FAIL_5
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。"
);
"Chatopera
云服务:无法访问该机器人,请确认【1】该服务器可以访问互联网,【2】该聊天机器人已经创建,【3】clientId和Secret正确设置。"
);
return
resp
;
}
catch
(
MalformedURLException
e
)
{
logger
.
error
(
"bot request error"
,
e
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_RC
,
RestUtils
.
RESP_RC_FAIL_4
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera云服务:不合法的聊天机器人服务URL。"
);
resp
.
addProperty
(
RestUtils
.
RESP_KEY_ERROR
,
"Chatopera
云服务:不合法的聊天机器人服务URL。"
);
return
resp
;
}
}
...
...
public/plugins/chatbot/classes/ChatbotEventHandler.java
浏览文件 @
830d5760
...
...
@@ -15,6 +15,7 @@
*/
package
com.chatopera.cc.plugins.chatbot
;
import
com.chatopera.bot.sdk.Response
;
import
com.chatopera.cc.acd.ACDServiceRouter
;
import
com.chatopera.cc.basic.Constants
;
import
com.chatopera.cc.basic.MainContext
;
...
...
@@ -31,6 +32,7 @@ import com.chatopera.cc.socketio.message.Message;
import
com.chatopera.cc.socketio.util.IMServiceUtils
;
import
com.chatopera.cc.util.IP
;
import
com.chatopera.cc.util.IPTools
;
import
com.chatopera.cc.util.SystemEnvHelper
;
import
com.corundumstudio.socketio.AckRequest
;
import
com.corundumstudio.socketio.SocketIOClient
;
import
com.corundumstudio.socketio.SocketIOServer
;
...
...
@@ -56,6 +58,9 @@ public class ChatbotEventHandler {
private
static
ChatbotRepository
chatbotRes
;
private
static
ChatbotProxy
chatbotProxy
;
private
final
static
String
botServiecProvider
=
SystemEnvHelper
.
getenv
(
ChatbotConstants
.
BOT_PROVIDER
,
ChatbotConstants
.
DEFAULT_BOT_PROVIDER
);
@Autowired
public
ChatbotEventHandler
(
SocketIOServer
server
)
{
this
.
server
=
server
;
...
...
@@ -107,14 +112,15 @@ public class ChatbotEventHandler {
if
(
invite
!=
null
)
{
Chatbot
chatbot
=
getChatbotRes
().
findOne
(
invite
.
getAiid
());
com
.
chatopera
.
bot
.
sdk
.
Chatbot
bot
=
new
com
.
chatopera
.
bot
.
sdk
.
Chatbot
(
chatbot
.
getClientId
(),
chatbot
.
getSecret
(),
chatbot
.
getBaseUrl
());
JSONObject
details
=
bot
.
details
();
chatbot
.
getClientId
(),
chatbot
.
getSecret
(),
botServiecProvider
);
Response
result
=
bot
.
command
(
"GET"
,
"/"
);
// 发送欢迎语
if
(
details
.
has
(
"rc"
)
&&
details
.
getInt
(
"rc"
)
==
0
)
{
if
(
result
.
getRc
()
==
0
)
{
ChatMessage
welcome
=
new
ChatMessage
();
String
welcomeTextMessage
=
details
.
getJSONObject
(
"data"
).
getString
(
"welcome"
);
JSONObject
details
=
(
JSONObject
)
result
.
getData
();
String
welcomeTextMessage
=
details
.
getString
(
"welcome"
);
if
(
StringUtils
.
isNotBlank
(
welcomeTextMessage
))
{
welcome
.
setCalltype
(
MainContext
.
CallType
.
OUT
.
toString
());
welcome
.
setAppid
(
appid
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录