Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pms-dispatch-assistant
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜耀祖
pms-dispatch-assistant
Commits
dcc49878
Commit
dcc49878
authored
Jun 05, 2025
by
赵灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加外部专家智能体
parent
6aea9c72
Pipeline
#21444
passed with stages
in 4 minutes and 27 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
23 deletions
+91
-23
LangChainController.java
...chassistant/controller/langchain/LangChainController.java
+10
-9
ChatService.java
.../dispatchassistant/domain/langchain/chat/ChatService.java
+13
-0
ai-chat.html
src/main/resources/static/pages/langchain/ai-chat.html
+9
-7
ai-chat-vue.js
src/main/resources/static/pages/langchain/js/ai-chat-vue.js
+36
-4
ai-chat.css
src/main/resources/static/pages/langchain/style/ai-chat.css
+23
-3
No files found.
src/main/java/com/infoepoch/pms/dispatchassistant/controller/langchain/LangChainController.java
View file @
dcc49878
...
...
@@ -287,23 +287,24 @@ public class LangChainController {
@RequestParam
String
selectedExpert
,
@RequestParam
String
selectedOrg
)
{
String
condition
=
""
;
String
regionName
=
chatService
.
getAuthRegionName
();
if
(
"
组织内"
.
equals
(
selectedOrg
)&&
StringUtils
.
isNotEmpty
(
regionName
))
{
condition
=
",只能查找"
+
regionName
;
}
else
if
(
"组织外"
.
equals
(
selectedOrg
)&&
StringUtils
.
isNotEmpty
(
regionName
))
{
condition
=
",排除"
+
regionName
;
if
(
"
内部专家"
.
equals
(
selectedExpert
))
{
if
(
"组织内"
.
equals
(
selectedOrg
)
&&
StringUtils
.
isNotEmpty
(
regionName
))
{
condition
=
",只能查找"
+
regionName
;
}
else
if
(
"组织外"
.
equals
(
selectedOrg
)
&&
StringUtils
.
isNotEmpty
(
regionName
))
{
condition
=
",排除"
+
regionName
;
}
}
String
urlAddr
=
"http://10.32.41.35:40517/scene_gateway/agent/6809d0895428476bb6789ad70c525c97"
;
// String urlAddr = "http://10.32.41.35:40517/scene_gateway/agent/6809d0895428476bb6789ad70c525c97";
String
urlAddr
=
chatService
.
getUrl
(
selectedExpert
);
//String urlAddr = "http://10.32.41.35:40517/scene_gateway/agent/83f77143b09c461993dd9a7db403eb94";
SseEmitter
emitter
=
new
SseEmitter
(
0L
);
QuestionRequest
questionRequest
=
new
QuestionRequest
();
questionRequest
.
setKeyword
(
chatMessage
+
condition
);
questionRequest
.
setRequestId
(
getRequestId
());
questionRequest
.
setDialogId
(
dialogId
);
Conversations
conversations
=
chatService
.
saveConversations
(
dialogId
,
chatMessage
,
"内部专家"
);
Conversations
conversations
=
chatService
.
saveConversations
(
dialogId
,
chatMessage
,
selectedExpert
);
Messages
messagesQusetion
=
new
Messages
();
messagesQusetion
.
setRequestId
(
dialogId
);
messagesQusetion
.
setContent
(
chatMessage
);
...
...
src/main/java/com/infoepoch/pms/dispatchassistant/domain/langchain/chat/ChatService.java
View file @
dcc49878
...
...
@@ -235,6 +235,7 @@ public class ChatService {
td
.
put
(
"time"
,
simpleDateFormat
.
format
(
conversations
.
getRecordTime
()));
td
.
put
(
"active"
,
false
);
td
.
put
(
"showMenu"
,
false
);
td
.
put
(
"selectedExpert"
,
conversations
.
getAiType
());
todayMapList
.
add
(
td
);
}
else
if
(
conversations
.
getRecordTime
().
before
(
todayDate
)&&
conversations
.
getRecordTime
().
after
(
yesterday
))
{
...
...
@@ -244,6 +245,7 @@ public class ChatService {
yd
.
put
(
"time"
,
simpleDateFormat
.
format
(
conversations
.
getRecordTime
()));
yd
.
put
(
"active"
,
false
);
yd
.
put
(
"showMenu"
,
false
);
yd
.
put
(
"selectedExpert"
,
conversations
.
getAiType
());
yesterdayMapList
.
add
(
yd
);
}
else
{
...
...
@@ -253,6 +255,7 @@ public class ChatService {
sd
.
put
(
"time"
,
simpleDateFormat
.
format
(
conversations
.
getRecordTime
()));
sd
.
put
(
"active"
,
false
);
sd
.
put
(
"showMenu"
,
false
);
sd
.
put
(
"selectedExpert"
,
conversations
.
getAiType
());
sevendayMapList
.
add
(
sd
);
}
}
...
...
@@ -335,4 +338,14 @@ public class ChatService {
return
regionName
;
}
//获取调用地址
public
String
getUrl
(
String
selectedExpert
)
{
String
url
=
"http://10.32.41.35:40517/scene_gateway/agent/6809d0895428476bb6789ad70c525c97"
;
if
(
"外部专家"
.
equals
(
selectedExpert
))
url
=
"http://10.32.41.35:40517/scene_gateway/agent/b6d5bceecb5644cf953d9cc859bd36d3"
;
return
url
;
}
}
src/main/resources/static/pages/langchain/ai-chat.html
View file @
dcc49878
...
...
@@ -37,7 +37,7 @@
:key=
"item.id"
class=
"history-item"
:class=
"{ active: item.active }"
:data-id=
"item.id"
@
click=
"loadChatHistory(item
.id
)"
>
:data-id=
"item.id"
@
click=
"loadChatHistory(item)"
>
<div
class=
"history-title"
>
{{ item.title }}
</div>
<button
class=
"delete-btn"
@
click
.
stop=
"deleteChat(item.id)"
>
<svg
viewBox=
"0 0 24 24"
width=
"16"
height=
"16"
stroke=
"currentColor"
stroke-width=
"2"
fill=
"none"
stroke-linecap=
"round"
stroke-linejoin=
"round"
>
...
...
@@ -94,8 +94,9 @@
<div
class=
"input-area-content"
>
<div
style=
"display: flex;align-items: center;justify-content: flex-start;"
>
<div
class=
"custom-select"
v-click-outside=
"closeExpertDropdown"
>
<div
class=
"selected-option"
@
click
.
stop=
"toggleExpertDropdown"
>
<span>
{{ selectedExpert }}
</span>
<div
class=
"selected-option"
@
click
.
stop=
"selectExpert('内部专家')"
:class=
"{ 'active': selectedExpert === '内部专家' }"
>
<span>
内部专家
</span>
<!-- <svg class="dropdown-icon" :class="{ 'rotated': showExpertDropdown }" viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">-->
<!-- <polyline points="6 9 12 15 18 9"></polyline>-->
<!-- </svg>-->
...
...
@@ -110,12 +111,13 @@
<!-- </div>-->
</div>
<div
class=
"custom-select"
v-click-outside=
"closeExpertDropdown"
>
<div
class=
"selected-option"
@
click
.
stop=
"toggleExpertDropdown"
>
<div
class=
"selected-option"
@
click
.
stop=
"selectExpert('外部专家')"
:class=
"{ 'active': selectedExpert === '外部专家' }"
>
<span>
外部专家
</span>
</div>
</div>
<div
class=
"custom-select"
v-click-outside=
"closeOrgDropdown"
>
<div
class=
"selected-option"
@
click
.
stop=
"toggleOrgDropdown"
>
<div
class=
"custom-select"
v-click-outside=
"closeOrgDropdown"
v-show=
"showOrgSelection"
>
<div
class=
"selected-option"
@
click
.
stop=
"toggleOrgDropdown"
style=
"background-color: rgba(230, 220, 250, 0.5);color: #6633ff;"
>
<span>
{{ selectedOrg }}
</span>
<svg
class=
"dropdown-icon"
:class=
"{ 'rotated': showOrgDropdown }"
viewBox=
"0 0 24 24"
width=
"16"
height=
"16"
stroke=
"currentColor"
stroke-width=
"2"
fill=
"none"
>
<polyline
points=
"6 9 12 15 18 9"
></polyline>
...
...
@@ -157,4 +159,4 @@
<!-- 引入Vue相关JS -->
<script
type=
"text/javascript"
src=
"js/ai-chat-vue.js"
></script>
</body>
</html>
\ No newline at end of file
</html>
\ No newline at end of file
src/main/resources/static/pages/langchain/js/ai-chat-vue.js
View file @
dcc49878
...
...
@@ -58,7 +58,8 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
// 消息列表
messages
:
[
// { role: 'ai', content: '您好!我是您的专家推荐助手,有什么可以帮助您的吗?' }
]
],
showOrgSelection
:
true
},
computed
:
{
isDarkTheme
()
{
...
...
@@ -208,6 +209,10 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
this
.
sendMessage
();
},
sendMessage
()
{
if
(
!
this
.
selectedExpert
)
{
this
.
showToast
(
'请先选择专家类型(内部/外部专家)'
);
return
;
}
const
message
=
this
.
userInput
.
trim
();
if
(
!
message
)
return
;
if
(
this
.
fistLoading
)
{
...
...
@@ -363,14 +368,18 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
// this.addChatToHistory('新对话', new Date());
});
this
.
fistLoading
=
true
;
this
.
selectedExpert
=
'内部专家'
;
this
.
showOrgSelection
=
this
.
selectedExpert
===
'内部专家'
;
this
.
selectedOrg
=
'全部组织'
;
// 重置滚动位置并重新启动自动滚动
this
.
scrollOffset
=
0
;
this
.
startAutoScroll
();
},
loadChatHistory
(
chat
Id
)
{
loadChatHistory
(
chat
)
{
var
that
=
this
var
chatId
=
chat
.
id
;
// 关闭所有菜单
this
.
historySections
.
forEach
(
section
=>
{
section
.
items
.
forEach
(
item
=>
{
...
...
@@ -395,7 +404,10 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
this
.
stopAutoScroll
();
}
this
.
fistLoading
=
false
;
this
.
selectedExpert
=
'内部专家'
;
this
.
showOrgSelection
=
this
.
selectedExpert
===
'内部专家'
;
this
.
selectedOrg
=
'全部组织'
;
//这里添加加载对应对话历史的逻辑
//实际实现时可以调用API获取历史记录
$
.
ajax
({
...
...
@@ -459,9 +471,18 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
},
selectExpert
(
expert
)
{
this
.
selectedExpert
=
expert
;
// this.selectedExpert = expert;
if
(
this
.
selectedExpert
===
expert
)
{
this
.
selectedExpert
=
''
;
}
else
{
this
.
selectedExpert
=
expert
;
}
this
.
showOrgSelection
=
expert
===
'内部专家'
;
this
.
selectedOrg
=
'全部组织'
;
// 立即关闭下拉框
this
.
showExpertDropdown
=
false
;
},
//组织内外选择相关方法
toggleOrgDropdown
()
{
...
...
@@ -474,6 +495,17 @@ require(['jquery', 'vue', 'utils','marked','markdown', 'global'], function ($, V
this
.
selectedOrg
=
org
;
// 立即关闭下拉框
this
.
showOrgDropdown
=
false
;
},
showToast
(
message
)
{
// 使用你项目中已有的提示组件,或创建一个简单的提示
const
toast
=
document
.
createElement
(
'div'
);
toast
.
className
=
'expert-toast'
;
toast
.
textContent
=
message
;
document
.
body
.
appendChild
(
toast
);
setTimeout
(()
=>
{
toast
.
remove
();
},
3000
);
}
}
});
...
...
src/main/resources/static/pages/langchain/style/ai-chat.css
View file @
dcc49878
...
...
@@ -577,8 +577,10 @@ body {
justify-content
:
center
;
padding
:
2px
5px
;
border-radius
:
8px
;
background-color
:
rgba
(
230
,
220
,
250
,
0.5
);
color
:
#6633ff
;
/*background-color: rgba(230, 220, 250, 0.5);*/
background-color
:
#f5f6fa
;
/*color: #6633ff;*/
color
:
#4c4c4c
;
font-size
:
14px
;
transition
:
all
0.2s
;
}
...
...
@@ -652,4 +654,22 @@ body {
.input-area-content
{
display
:
flex
;
align-items
:
center
;
}
\ No newline at end of file
}
.selected-option.active
{
/* 选中样式 */
/*background-color: #f5f6fa;*/
background-color
:
rgba
(
230
,
220
,
250
,
0.5
);
/*color: #272933;*/
color
:
#6633ff
;
}
.expert-toast
{
position
:
fixed
;
left
:
50%
;
top
:
65%
;
/* 垂直居中 */
background-color
:
rgba
(
230
,
220
,
250
,
0.5
);
color
:
#6633ff
;
padding
:
10px
20px
;
border-radius
:
4px
;
z-index
:
1000
;
}
\ No newline at end of file
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