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
854104e8
Commit
854104e8
authored
Apr 24, 2025
by
赵灿灿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改信息
parent
5886cdac
Pipeline
#21110
passed with stages
in 3 minutes and 28 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
LangChainController.java
...chassistant/controller/langchain/LangChainController.java
+4
-5
ai-chat.html
src/main/resources/static/pages/langchain/ai-chat.html
+2
-2
No files found.
src/main/java/com/infoepoch/pms/dispatchassistant/controller/langchain/LangChainController.java
View file @
854104e8
...
...
@@ -294,7 +294,7 @@ public class LangChainController {
{
condition
=
",排除"
+
regionName
;
}
logger
.
info
(
"开始调用1"
);
String
urlAddr
=
"http://10.32.41.35:40517/scene_gateway/agent/6809d0895428476bb6789ad70c525c97"
;
//String urlAddr = "http://10.32.41.35:40517/scene_gateway/agent/83f77143b09c461993dd9a7db403eb94";
SseEmitter
emitter
=
new
SseEmitter
(
0L
);
...
...
@@ -318,6 +318,7 @@ public class LangChainController {
chatService
.
insertMessage
(
conversations
,
messagesContent
);
String
params
=
JsonUtils
.
objectToJson
(
questionRequest
);
StringBuffer
content
=
new
StringBuffer
();
StringBuffer
lineCotent
=
new
StringBuffer
();
new
Thread
(()
->
{
HttpURLConnection
connection
=
null
;
try
{
...
...
@@ -333,20 +334,16 @@ public class LangChainController {
// 设置超时为0,表示无限制
connection
.
setConnectTimeout
(
0
);
connection
.
setReadTimeout
(
0
);
logger
.
info
(
params
);
try
(
OutputStream
os
=
connection
.
getOutputStream
())
{
os
.
write
(
params
.
getBytes
(
StandardCharsets
.
UTF_8
));
os
.
flush
();
}
logger
.
info
(
"开始调用2"
);
// 检查响应码
int
responseCode
=
connection
.
getResponseCode
();
if
(
responseCode
!=
HttpURLConnection
.
HTTP_OK
)
{
emitter
.
completeWithError
(
new
RuntimeException
(
"SSE 连接失败: "
+
responseCode
));
return
;
}
logger
.
info
(
"开始调用3"
);
// 持续读取 SSE 数据流
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
())))
{
String
line
;
...
...
@@ -360,6 +357,7 @@ public class LangChainController {
emitter
.
send
(
SseEmitter
.
event
().
data
(
"stop"
),
MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
));
}
else
{
lineCotent
.
append
(
data
);
String
sendData
=
data
.
replace
(
"attachment#[]#attachment"
,
""
).
replace
(
"source#[]#source"
,
""
)
.
replace
(
"<br />"
,
"\n"
).
replace
(
"#"
,
""
).
replace
(
"*"
,
""
);
emitter
.
send
(
SseEmitter
.
event
().
data
(
sendData
),
MediaType
.
parseMediaType
(
"application/json; charset=UTF-8"
));
...
...
@@ -371,6 +369,7 @@ public class LangChainController {
}
}
emitter
.
complete
();
// 流结束
logger
.
info
(
lineCotent
.
toString
());
}
catch
(
Exception
e
)
{
emitter
.
completeWithError
(
e
);
logger
.
info
(
e
.
getMessage
());
...
...
src/main/resources/static/pages/langchain/ai-chat.html
View file @
854104e8
...
...
@@ -2,7 +2,7 @@
<html
lang=
"zh-CN"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
推荐专家智能助手
</title>
<title>
智能推荐专家
</title>
<link
rel=
"stylesheet"
href=
"style/ai-chat.css"
>
<style>
[
v-cloak
]
{
...
...
@@ -15,7 +15,7 @@
<!-- 左侧历史对话列表 -->
<div
class=
"sidebar"
>
<div
class=
"sidebar-header"
>
<h1>
推荐专家智能助手
</h1>
<h1>
智能推荐专家
</h1>
<!-- 添加主题切换按钮 -->
<div
id=
"theme-toggle"
class=
"theme-toggle"
title=
"切换主题"
@
click=
"toggleTheme"
>
<svg
id=
"light-icon"
viewBox=
"0 0 24 24"
:style=
"{display: isDarkTheme ? 'block' : 'none'}"
>
...
...
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