Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pangea-Agent
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
2
Merge Requests
2
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
Gavin-Group
Pangea-Agent
Commits
5fae7eda
Commit
5fae7eda
authored
Dec 24, 2025
by
youxiaoji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ [增加访客预约助手]
parent
4ff6c595
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
389 additions
and
4 deletions
+389
-4
DefaultReactExecutor.java
...java/pangea/hiagent/agent/react/DefaultReactExecutor.java
+7
-3
AgentChatService.java
...n/java/pangea/hiagent/agent/service/AgentChatService.java
+2
-1
UserSseService.java
...rc/main/java/pangea/hiagent/agent/sse/UserSseService.java
+8
-0
Contants.java
...d/src/main/java/pangea/hiagent/common/utils/Contants.java
+5
-0
HybridUniqueLongGenerator.java
...angea/hiagent/common/utils/HybridUniqueLongGenerator.java
+40
-0
InputCodeGenerator.java
.../java/pangea/hiagent/common/utils/InputCodeGenerator.java
+39
-0
VisitorAppointmentTool.java
...java/pangea/hiagent/tool/impl/VisitorAppointmentTool.java
+288
-0
No files found.
backend/src/main/java/pangea/hiagent/agent/react/DefaultReactExecutor.java
View file @
5fae7eda
...
...
@@ -8,7 +8,9 @@ import org.springframework.ai.chat.prompt.Prompt;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.context.annotation.Lazy
;
import
pangea.hiagent.agent.sse.UserSseService
;
import
pangea.hiagent.tool.impl.HisenseTripTool
;
import
pangea.hiagent.tool.impl.VisitorAppointmentTool
;
import
pangea.hiagent.web.service.AgentService
;
import
pangea.hiagent.web.service.InfoCollectorService
;
import
pangea.hiagent.workpanel.IWorkPanelDataCollector
;
...
...
@@ -60,7 +62,9 @@ public class DefaultReactExecutor implements ReactExecutor {
private
AgentService
agentService
;
private
final
AgentToolManager
agentToolManager
;
@Autowired
private
UserSseService
userSseService
;
public
DefaultReactExecutor
(
AgentToolManager
agentToolManager
)
{
this
.
agentToolManager
=
agentToolManager
;
}
...
...
@@ -176,7 +180,7 @@ public class DefaultReactExecutor implements ReactExecutor {
memoryService
.
getHistoryMessages
(
sessionId
,
historyLength
);
// 添加历史消息到Prompt
messages
.
addAll
(
historyMessages
);
//
messages.addAll(historyMessages);
// 将当前用户消息添加到内存中,以便下次对话使用
memoryService
.
addUserMessageToMemory
(
sessionId
,
userInput
);
...
...
@@ -231,7 +235,7 @@ public class DefaultReactExecutor implements ReactExecutor {
// 构建Prompt,包含历史对话记录
Prompt
prompt
=
buildPromptWithHistory
(
DEFAULT_SYSTEM_PROMPT
,
userInput
,
agent
);
HisenseTripTool
hisenseTripTool
=
new
HisenseTripTool
(
agentService
,
infoCollector
Service
);
VisitorAppointmentTool
hisenseTripTool
=
new
VisitorAppointmentTool
(
agentService
,
infoCollectorService
,
userSse
Service
);
hisenseTripTool
.
initialize
();
// 订阅流式响应
chatClient
.
prompt
(
prompt
)
...
...
backend/src/main/java/pangea/hiagent/agent/service/AgentChatService.java
View file @
5fae7eda
...
...
@@ -121,7 +121,8 @@ public class AgentChatService {
// 创建 SSE emitter
SseEmitter
emitter
=
workPanelSseService
.
createEmitter
();
workPanelSseService
.
registerEmitter
(
"worker1"
,
emitter
);
// 将userId设为final以在Lambda表达式中使用
final
String
finalUserId
=
userId
;
...
...
backend/src/main/java/pangea/hiagent/agent/sse/UserSseService.java
View file @
5fae7eda
...
...
@@ -552,4 +552,12 @@ public class UserSseService {
Thread
.
currentThread
().
interrupt
();
}
}
public
void
registerEmitter
(
String
id
,
SseEmitter
emitter
)
{
this
.
userEmitters
.
put
(
id
,
emitter
);
}
public
SseEmitter
getEmitter
(
String
id
)
{
return
userEmitters
.
get
(
id
);
}
}
\ No newline at end of file
backend/src/main/java/pangea/hiagent/common/utils/Contants.java
View file @
5fae7eda
...
...
@@ -14,6 +14,9 @@ public class Contants {
" \"locator\": {\n"
+
" \"type\": \"string\"\n"
+
" },\n"
+
" \"label_tag\": {\n"
+
" \"type\": \"string\"\n"
+
" },\n"
+
" \"attributes\": {\n"
+
" \"type\": \"object\",\n"
+
" \"properties\": {\n"
+
...
...
@@ -78,4 +81,6 @@ public class Contants {
" ]\n"
+
" }\n"
+
"}"
;
}
backend/src/main/java/pangea/hiagent/common/utils/HybridUniqueLongGenerator.java
0 → 100644
View file @
5fae7eda
package
pangea
.
hiagent
.
common
.
utils
;
import
java.security.SecureRandom
;
import
java.util.concurrent.atomic.AtomicLong
;
public
class
HybridUniqueLongGenerator
{
private
static
final
SecureRandom
random
=
new
SecureRandom
();
private
static
final
AtomicLong
counter
=
new
AtomicLong
(
0
);
public
static
long
generateUnique13DigitNumber
()
{
long
timestamp
=
System
.
currentTimeMillis
();
long
count
=
counter
.
incrementAndGet
();
// 使用时间戳的前10位 + 计数器的后3位
long
timestampPart
=
(
timestamp
/
1000
)
*
1000
;
long
counterPart
=
count
%
1000
;
return
timestampPart
+
counterPart
;
}
// 更随机的版本,但仍保证唯一
public
static
synchronized
long
generateRandomUnique
()
{
long
timestamp
=
System
.
currentTimeMillis
();
// 在时间戳基础上加上一个小的随机偏移
int
randomOffset
=
random
.
nextInt
(
100
);
long
result
=
timestamp
*
100
+
randomOffset
;
// 确保是13位
while
(
result
>=
10000000000000L
)
{
result
/=
10
;
}
while
(
result
<
1000000000000L
)
{
result
*=
10
;
result
+=
random
.
nextInt
(
10
);
}
return
result
;
}
}
\ No newline at end of file
backend/src/main/java/pangea/hiagent/common/utils/InputCodeGenerator.java
0 → 100644
View file @
5fae7eda
package
pangea
.
hiagent
.
common
.
utils
;
import
java.security.SecureRandom
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.concurrent.atomic.AtomicLong
;
public
class
InputCodeGenerator
{
private
static
final
String
CHARS
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
;
private
static
final
SecureRandom
random
=
new
SecureRandom
();
private
static
final
AtomicLong
sequence
=
new
AtomicLong
(
0
);
public
static
String
generateUniqueInputCode
(
String
prefix
)
{
// 当前时间戳(毫秒)
long
timestamp
=
System
.
currentTimeMillis
();
// 序列号
long
seq
=
sequence
.
incrementAndGet
();
// 组合时间戳和序列号
long
combined
=
(
timestamp
<<
10
)
|
(
seq
&
0x3FF
);
// 取序列号后10位
// 转为36进制
String
code
=
Long
.
toString
(
Math
.
abs
(
combined
),
36
).
toUpperCase
();
// 确保8位长度
if
(
code
.
length
()
>
8
)
{
code
=
code
.
substring
(
code
.
length
()
-
8
);
}
else
if
(
code
.
length
()
<
8
)
{
// 前面补随机字符
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
code
.
length
();
i
<
8
;
i
++)
{
sb
.
append
(
CHARS
.
charAt
(
random
.
nextInt
(
CHARS
.
length
())));
}
code
=
sb
.
toString
()
+
code
;
}
return
prefix
+
code
;
}
}
backend/src/main/java/pangea/hiagent/tool/impl/VisitorAppointmentTool.java
0 → 100644
View file @
5fae7eda
This diff is collapsed.
Click to expand it.
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