Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
konke-ai-alibaba-mcp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何金镒
konke-ai-alibaba-mcp
Commits
0957bbba
Commit
0957bbba
authored
Sep 12, 2025
by
何金镒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
思必驰的兜底技能 2
parent
317ab450
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
src/main/java/com/ikonke/konkeaialibabamcp/controller/DifyController.java
...m/ikonke/konkeaialibabamcp/controller/DifyController.java
+18
-4
src/main/resources/application-prod.yml
src/main/resources/application-prod.yml
+1
-0
src/main/resources/application-test.yml
src/main/resources/application-test.yml
+1
-0
No files found.
src/main/java/com/ikonke/konkeaialibabamcp/controller/DifyController.java
View file @
0957bbba
...
...
@@ -40,6 +40,8 @@ public class DifyController {
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
@Value
(
"${cdc.difyChatSteamMessages}"
)
private
String
difyChatSteamMessages
;
private
String
dify_api_key
;
...
...
@@ -56,10 +58,16 @@ public class DifyController {
}
}
/**
* 思必驰 demo
* https://www.duiopen.com/docs/ct_dsk_protocol
*
*/
@RequestMapping
(
value
=
"/demo"
,
method
=
RequestMethod
.
POST
,
consumes
=
"application/json"
)
@ResponseBody
public
JSONObject
demo
(
@RequestBody
JSONObject
jsonObject
)
{
log
.
info
(
"demo..请求参数:{}"
,
jsonObject
.
toString
());
Long
timestamp
=
System
.
currentTimeMillis
();
log
.
info
(
"思必驰 demo..请求参数:{}"
,
jsonObject
.
toString
());
JSONObject
result
=
jsonObject
.
getJSONObject
(
"request"
);
JSONObject
context
=
jsonObject
.
getJSONObject
(
"context"
);
JSONObject
device
=
context
.
getJSONObject
(
"device"
);
...
...
@@ -70,6 +78,8 @@ public class DifyController {
String
type
=
result
.
get
(
"type"
).
toString
();
String
input
;
//请求文本
String
res
=
"{'version': '1.0','response': {'speak': {'type': 'text','text': '%s','ssml': 'SSML markup text string to speak'}},'shouldEndSession': %b}"
;
//忽略了部分DSK协议字段,shouldEndSession字段决定是否结束本轮对话
JSONObject
response
=
JSONUtil
.
parseObj
(
String
.
format
(
res
,
"error"
,
true
));
// 响应报文
JSONArray
slots
;
String
ai_result
=
""
;
...
...
@@ -92,6 +102,9 @@ public class DifyController {
// }
// response = JSONUtil.parseObj(res);
// }
if
(
type
.
equals
(
"start"
))
{
log
.
info
(
"新一轮对话开始..........."
);
}
//根据userId获取到对应的主机号等信息
QueryWrapper
<
CDCToken
>
wrapper
=
new
QueryWrapper
<>();
...
...
@@ -100,12 +113,12 @@ public class DifyController {
if
(
list
.
size
()
==
1
){
CDCToken
token
=
list
.
get
(
0
);
String
url
=
"http://172.17.12.12:9998
/dify/chatSteamMessages?query="
+
input
;
String
url
=
difyChatSteamMessages
+
"
/dify/chatSteamMessages?query="
+
input
;
ai_result
=
HttpRequest
.
get
(
url
)
.
header
(
"ccuName"
,
token
.
getCcuId
()
)
.
header
(
"token"
,
token
.
getAccessToken
())
.
header
(
"sn"
,
token
.
getSn
())
.
timeout
(
10
00000
)
.
timeout
(
6
00000
)
.
execute
().
body
();
log
.
info
(
"dify请求返回:{}"
,
ai_result
);
...
...
@@ -128,6 +141,7 @@ public class DifyController {
response
=
JSONUtil
.
parseObj
(
res
);
e
.
printStackTrace
();
}
finally
{
log
.
info
(
"思必驰 demo..响应时间="
+(
System
.
currentTimeMillis
()-
timestamp
));
return
response
;
}
}
...
...
@@ -296,7 +310,7 @@ public class DifyController {
body
.
set
(
"conversation_id"
,
conversationId
);
}
log
.
info
(
"dify key:{} , 对话 body:{}"
,
dify_api_key
,
body
);
log
.
info
(
"dify key:{} ,
流式
对话 body:{}"
,
dify_api_key
,
body
);
return
webClient
.
post
()
...
...
src/main/resources/application-prod.yml
View file @
0957bbba
...
...
@@ -52,4 +52,5 @@ konke:
cdc
:
timeout
:
20000
url
:
http://community.jfzhtest.com/prod-api
difyChatSteamMessages
:
http://127.0.0.1:${server.port}
src/main/resources/application-test.yml
View file @
0957bbba
...
...
@@ -49,3 +49,4 @@ konke:
cdc
:
timeout
:
20000
url
:
http://community.jfzhtest.com/prod-api
difyChatSteamMessages
:
http://172.17.12.12:${server.port}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment