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
d532e54a
Commit
d532e54a
authored
Oct 10, 2025
by
何金镒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增communityCode
parent
2778b066
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
16 deletions
+45
-16
src/main/java/com/ikonke/konkeaialibabamcp/controller/DifyControllerV2.java
...ikonke/konkeaialibabamcp/controller/DifyControllerV2.java
+26
-13
src/main/java/com/ikonke/konkeaialibabamcp/entity/cdc/UserEntity.java
...a/com/ikonke/konkeaialibabamcp/entity/cdc/UserEntity.java
+9
-0
src/main/resources/application-prod.yml
src/main/resources/application-prod.yml
+5
-1
src/main/resources/application-test.yml
src/main/resources/application-test.yml
+3
-0
src/test/java/com/ikonke/konkeaialibabamcp/KonkeAiAlibabaMcpApplicationTests.java
.../konkeaialibabamcp/KonkeAiAlibabaMcpApplicationTests.java
+2
-2
No files found.
src/main/java/com/ikonke/konkeaialibabamcp/controller/DifyControllerV2.java
View file @
d532e54a
...
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
...
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONUtil;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.ikonke.konkeaialibabamcp.constant.RedisKeys
;
import
com.ikonke.konkeaialibabamcp.constant.RedisKeys
;
import
com.ikonke.konkeaialibabamcp.controller.param.DifyStreamResponse
;
import
com.ikonke.konkeaialibabamcp.controller.param.DifyStreamResponse
;
import
com.ikonke.konkeaialibabamcp.entity.cdc.UserEntity
;
import
com.ikonke.konkeaialibabamcp.entity.mysql.CDCToken
;
import
com.ikonke.konkeaialibabamcp.entity.mysql.CDCToken
;
import
com.ikonke.konkeaialibabamcp.event.mode.DifyChatSteamEvent
;
import
com.ikonke.konkeaialibabamcp.event.mode.DifyChatSteamEvent
;
import
com.ikonke.konkeaialibabamcp.service.cdc.CdcHttpUtils
;
import
com.ikonke.konkeaialibabamcp.service.cdc.CdcHttpUtils
;
...
@@ -48,24 +49,25 @@ public class DifyControllerV2 {
...
@@ -48,24 +49,25 @@ public class DifyControllerV2 {
@Value
(
"${cdc.difyChatSteamMessages}"
)
@Value
(
"${cdc.difyChatSteamMessages}"
)
private
String
difyChatSteamMessages
;
private
String
difyChatSteamMessages
;
@Value
(
"${dify.key}"
)
private
String
dify_api_key
;
private
String
dify_api_key
;
public
DifyControllerV2
(
ApplicationEventPublisher
eventPublisher
)
{
public
DifyControllerV2
(
ApplicationEventPublisher
eventPublisher
)
{
this
.
eventPublisher
=
eventPublisher
;
this
.
eventPublisher
=
eventPublisher
;
}
}
@PostConstruct
//
@PostConstruct
public
void
init
()
{
//
public void init() {
Object
redisValue
=
redisTemplate
.
opsForValue
().
get
(
RedisKeys
.
KONKE_DIFY_API_KEY
);
//
Object redisValue = redisTemplate.opsForValue().get(RedisKeys.KONKE_DIFY_API_KEY);
//
// 如果Redis中有值,则使用Redis中的值覆盖配置文件的值
//
// 如果Redis中有值,则使用Redis中的值覆盖配置文件的值
if
(
redisValue
!=
null
)
{
//
if (redisValue != null) {
this
.
dify_api_key
=
redisValue
.
toString
();
//
this.dify_api_key = redisValue.toString();
log
.
info
(
"Using Dify API key from Redis: {}"
,
this
.
dify_api_key
);
//
log.info("Using Dify API key from Redis: {}", this.dify_api_key);
}
else
{
//
} else {
log
.
info
(
"Using Dify API key from configuration file: {}"
,
this
.
dify_api_key
);
//
log.info("Using Dify API key from configuration file: {}", this.dify_api_key);
}
//
}
}
//
}
...
@@ -102,7 +104,7 @@ public class DifyControllerV2 {
...
@@ -102,7 +104,7 @@ public class DifyControllerV2 {
if
(
list
.
size
()
==
1
){
if
(
list
.
size
()
==
1
){
CDCToken
token
=
list
.
get
(
0
);
CDCToken
token
=
list
.
get
(
0
);
if
(
StrUtil
.
isBlank
(
token
.
getCcuId
())){
if
(
StrUtil
.
isBlank
(
token
.
getCcuId
())){
res
=
String
.
format
(
res
,
"未绑定主机
绑定
"
,
false
);
res
=
String
.
format
(
res
,
"未绑定主机"
,
false
);
response
=
JSONUtil
.
parseObj
(
res
);
response
=
JSONUtil
.
parseObj
(
res
);
}
}
...
@@ -168,6 +170,8 @@ public class DifyControllerV2 {
...
@@ -168,6 +170,8 @@ public class DifyControllerV2 {
return
Flux
.
just
(
"未绑定社区账号"
);
return
Flux
.
just
(
"未绑定社区账号"
);
}
}
UserEntity
userEntity
=
cdcHttpUtils
.
getOwner
(
sn
);
//workflows/run
//workflows/run
String
url
=
"http://172.17.12.12:8088/v1/chat-messages"
;
String
url
=
"http://172.17.12.12:8088/v1/chat-messages"
;
...
@@ -175,6 +179,14 @@ public class DifyControllerV2 {
...
@@ -175,6 +179,14 @@ public class DifyControllerV2 {
inputs
.
set
(
"ccuName"
,
token
.
getCcuId
());
inputs
.
set
(
"ccuName"
,
token
.
getCcuId
());
inputs
.
set
(
"sn"
,
sn
);
inputs
.
set
(
"sn"
,
sn
);
inputs
.
set
(
"token"
,
token
.
getAccessToken
());
inputs
.
set
(
"token"
,
token
.
getAccessToken
());
inputs
.
set
(
"communityCode"
,
userEntity
.
getCommunityCode
());
inputs
.
set
(
"communityId"
,
userEntity
.
getCommunityId
());
inputs
.
set
(
"easId"
,
userEntity
.
getEasId
());
inputs
.
set
(
"roomId"
,
userEntity
.
getRoomInfo
().
getRoomId
());
inputs
.
set
(
"roomName"
,
userEntity
.
getRoomInfo
().
getRoomId
());
inputs
.
set
(
"buildingId"
,
userEntity
.
getRoomInfo
().
getBuildingId
());
inputs
.
set
(
"userPhone"
,
userEntity
.
getPhoneNum
());
inputs
.
set
(
"userName"
,
userEntity
.
getPhoneNum
());
JSONObject
body
=
new
JSONObject
();
JSONObject
body
=
new
JSONObject
();
body
.
set
(
"inputs"
,
inputs
);
body
.
set
(
"inputs"
,
inputs
);
...
@@ -182,6 +194,7 @@ public class DifyControllerV2 {
...
@@ -182,6 +194,7 @@ public class DifyControllerV2 {
body
.
set
(
"response_mode"
,
"streaming"
);
//blocking 阻塞模式,streaming 流式模式
body
.
set
(
"response_mode"
,
"streaming"
);
//blocking 阻塞模式,streaming 流式模式
body
.
set
(
"user"
,
sn
);
body
.
set
(
"user"
,
sn
);
String
redis_key
=
RedisKeys
.
KONKE_DIFY_CONVERSATION_ID
+
sn
;
String
redis_key
=
RedisKeys
.
KONKE_DIFY_CONVERSATION_ID
+
sn
;
Object
redis_conversationId
=
redisTemplate
.
opsForValue
().
get
(
redis_key
);
Object
redis_conversationId
=
redisTemplate
.
opsForValue
().
get
(
redis_key
);
String
conversationId
=
null
;
String
conversationId
=
null
;
...
...
src/main/java/com/ikonke/konkeaialibabamcp/entity/cdc/UserEntity.java
View file @
d532e54a
...
@@ -69,6 +69,15 @@ public class UserEntity implements Serializable {
...
@@ -69,6 +69,15 @@ public class UserEntity implements Serializable {
public
String
easId
;
public
String
easId
;
public
OwnerRoom
ownerRoom
;
public
OwnerRoom
ownerRoom
;
public
RoomInfo
roomInfo
;
public
RoomInfo
roomInfo
;
public
String
communityCode
;
public
String
getCommunityCode
()
{
return
communityCode
;
}
public
void
setCommunityCode
(
String
communityCode
)
{
this
.
communityCode
=
communityCode
;
}
public
String
getOwnerId
()
{
public
String
getOwnerId
()
{
return
ownerId
;
return
ownerId
;
...
...
src/main/resources/application-prod.yml
View file @
d532e54a
...
@@ -53,8 +53,12 @@ konke:
...
@@ -53,8 +53,12 @@ konke:
appKey
:
216531bf-6394-455d-98c0-87d74ad2fcc5
appKey
:
216531bf-6394-455d-98c0-87d74ad2fcc5
baseUrl
:
http://172.24.10.11:16000
baseUrl
:
http://172.24.10.11:16000
dify
:
key
:
app-Lev1PRD3VBWH9P0AhfnywKJT
cdc
:
cdc
:
timeout
:
20000
timeout
:
20000
url
:
https://sqdn.cndmega.com/prod-v2.0.1
# url: https://sqdn.cndmega.com/prod-v2.0.1
url
:
http://community.jfzhtest.com/prod-api
difyChatSteamMessages
:
http://127.0.0.1:${server.port}
difyChatSteamMessages
:
http://127.0.0.1:${server.port}
src/main/resources/application-test.yml
View file @
d532e54a
...
@@ -46,6 +46,9 @@ konke:
...
@@ -46,6 +46,9 @@ konke:
appKey
:
0c350d82-aa95-46e1-91b8-b8d508b5226a
appKey
:
0c350d82-aa95-46e1-91b8-b8d508b5226a
baseUrl
:
http://172.17.12.6:10000
baseUrl
:
http://172.17.12.6:10000
dify
:
key
:
app-Lev1PRD3VBWH9P0AhfnywKJT
cdc
:
cdc
:
timeout
:
20000
timeout
:
20000
url
:
http://community.jfzhtest.com/prod-api
url
:
http://community.jfzhtest.com/prod-api
...
...
src/test/java/com/ikonke/konkeaialibabamcp/KonkeAiAlibabaMcpApplicationTests.java
View file @
d532e54a
...
@@ -38,11 +38,11 @@ class KonkeAiAlibabaMcpApplicationTests {
...
@@ -38,11 +38,11 @@ class KonkeAiAlibabaMcpApplicationTests {
// @Test
// @Test
// void redistest() {
// void redistest() {
// String redis_key = RedisKeys.KONKE_DIFY_CONVERSATION_ID+ sn;
//
//
String redis_key = RedisKeys.KONKE_DIFY_CONVERSATION_ID+ sn;
//
//
// Set<String> keys = redisTemplate.keys(RedisKeys.KONKE_DIFY_CONVERSATION_ID + "*");
// Set<String> keys = redisTemplate.keys(RedisKeys.KONKE_DIFY_CONVERSATION_ID + "*");
// for(String key : keys){
// for(String key : keys){
// System.out.println( key);
// System.out.println(
"----->"+
key);
// redisTemplate.delete(key);
// redisTemplate.delete(key);
// }
// }
// }
// }
...
...
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