Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ai
/
ai-workflow
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 32149e60
authored
Jun 22, 2026
by
sunqi02
Committed by
胡悦
Jul 06, 2026
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 修复消息历史处理逻辑,确保只处理包含名称字段的消息;更新测试请求数据
1 parent
78d750db
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
workspace/agent-admin/backend/app/service/agent_hub.py
workspace/agent-admin/backend/skills/query-knowledge/scripts/query_knowledge.py
workspace/agent-admin/backend/test_request.json
workspace/agent-admin/backend/app/service/agent_hub.py
View file @
32149e6
...
@@ -510,9 +510,9 @@ class AgentHub:
...
@@ -510,9 +510,9 @@ class AgentHub:
system_prompt
=
self
.
_build_sub_agent_prompt
(
target_agent
)
system_prompt
=
self
.
_build_sub_agent_prompt
(
target_agent
)
# Bridge: convert SessionStore dict history → AgentScope Msg[]
# Bridge: convert SessionStore dict history → AgentScope Msg[]
# 跳过旧格式消息(DB 冷恢复可能残留 pre-AgentScope 格式,缺少 name 字段)
agent_memory
=
InMemoryMemory
()
agent_memory
=
InMemoryMemory
()
recent
=
messages
[
-
10
:]
history_msgs
=
[
Msg
.
from_dict
(
m
)
for
m
in
messages
if
"name"
in
m
]
history_msgs
=
[
Msg
.
from_dict
(
m
)
for
m
in
recent
]
if
history_msgs
:
if
history_msgs
:
await
agent_memory
.
add
(
history_msgs
)
await
agent_memory
.
add
(
history_msgs
)
history_msg_count
=
len
(
history_msgs
)
# 用于后续只保存本次 ReAct 新增的工具消息
history_msg_count
=
len
(
history_msgs
)
# 用于后续只保存本次 ReAct 新增的工具消息
...
...
workspace/agent-admin/backend/skills/query-knowledge/scripts/query_knowledge.py
View file @
32149e6
...
@@ -57,6 +57,8 @@ def main():
...
@@ -57,6 +57,8 @@ def main():
sys
.
exit
(
0
)
sys
.
exit
(
0
)
answers
=
data
.
get
(
"answer"
,
[])
answers
=
data
.
get
(
"answer"
,
[])
if
isinstance
(
answers
,
str
):
answers
=
[
answers
]
if
not
answers
:
if
not
answers
:
print
(
"❌未检索到相关知识,建议换个方式描述问题再试"
)
print
(
"❌未检索到相关知识,建议换个方式描述问题再试"
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
@@ -66,8 +68,8 @@ def main():
...
@@ -66,8 +68,8 @@ def main():
text
=
item
text
=
item
else
:
else
:
text
=
item
.
get
(
"text"
,
""
)
text
=
item
.
get
(
"text"
,
""
)
if
text
:
if
text
.
strip
()
:
print
(
text
)
print
(
text
.
strip
()
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
workspace/agent-admin/backend/test_request.json
View file @
32149e6
{
{
"group"
:
{
"group"
:
{
"group_contact_id"
:
"
EFD61E74ABE87CE0CE0C8D3529ED8B9E5194F219CF554649F1C4F9C615435A82
"
,
"group_contact_id"
:
"
R:10703895153162878
"
,
"group_name"
:
"岗位销售新服务群"
"group_name"
:
"岗位销售新服务群"
},
},
"agents"
:
[
"agents"
:
[
{
"agent_id"
:
11
,
"bot_id"
:
"ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82"
,
"is_steward"
:
true
},
{
"agent_id"
:
11
,
"bot_id"
:
"5bcf81fa616f4b5aa836cc1f28eaa941"
,
"is_steward"
:
true
},
{
"agent_id"
:
17
,
"bot_id"
:
"ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82"
,
"is_steward"
:
false
}
{
"agent_id"
:
17
,
"bot_id"
:
"e02a9b3a27564c87875bfb5e74ffb564"
,
"is_steward"
:
false
},
{
"agent_id"
:
21
,
"bot_id"
:
"ee79dee25ce24003b5d14d8235240bc2"
,
"is_steward"
:
false
}
],
],
"messages"
:
[
"messages"
:
[
{
{
...
@@ -13,8 +14,8 @@
...
@@ -13,8 +14,8 @@
"msg_time"
:
"2026-05-26T10:00:00Z"
,
"msg_time"
:
"2026-05-26T10:00:00Z"
,
"sender_id"
:
""
,
"sender_id"
:
""
,
"sender_name"
:
"孙奇"
,
"sender_name"
:
"孙奇"
,
"msg_type"
:
"
other
"
,
"msg_type"
:
"
text
"
,
"msg_content"
:
"
3月25日.mp3
"
,
"msg_content"
:
"
课程涵盖哪些内容?
"
,
"payload"
:
{}
"payload"
:
{}
}
}
]
]
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment