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 98e8391f
authored
May 22, 2026
by
sunqi02
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
消除歧义,避免调用sub agent失败
1 parent
7be83f49
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
workspace/agent-admin/backend/app/service/agent_hub.py
workspace/agent-admin/backend/app/service/agent_hub.py
View file @
98e8391
...
@@ -119,7 +119,10 @@ class AgentHub:
...
@@ -119,7 +119,10 @@ class AgentHub:
continue
continue
if
allowed_agent_codes
is
not
None
and
code
not
in
allowed_agent_codes
:
if
allowed_agent_codes
is
not
None
and
code
not
in
allowed_agent_codes
:
continue
continue
duty_lines
.
append
(
f
"- {agent.name}({agent.role}): {agent.prompt_template}"
)
duty_lines
.
append
(
f
"- {agent.name}({agent.role},调用码: {code}): "
f
"{agent.prompt_template}"
)
duties_text
=
"
\n
"
.
join
(
duty_lines
)
if
duty_lines
else
"暂无子Agent"
duties_text
=
"
\n
"
.
join
(
duty_lines
)
if
duty_lines
else
"暂无子Agent"
...
@@ -294,7 +297,11 @@ class AgentHub:
...
@@ -294,7 +297,11 @@ class AgentHub:
async
def
_call_sub_agent
(
self
,
agent_code
:
str
,
instruction
:
str
)
->
str
:
async
def
_call_sub_agent
(
self
,
agent_code
:
str
,
instruction
:
str
)
->
str
:
"""通过 ReActAgent 调用子 Agent。"""
"""通过 ReActAgent 调用子 Agent。"""
if
agent_code
not
in
self
.
agents
:
if
agent_code
not
in
self
.
agents
:
return
f
"错误:子 Agent '{agent_code}' 不存在"
valid
=
[
c
for
c
in
self
.
agents
if
c
!=
"main"
]
return
(
f
"错误:子 Agent '{agent_code}' 不存在。"
f
"可用调用码: {valid}"
)
sub_prompt
=
self
.
_build_sub_agent_prompt
(
agent_code
,
{})
sub_prompt
=
self
.
_build_sub_agent_prompt
(
agent_code
,
{})
sub_memory
=
InMemoryMemory
()
sub_memory
=
InMemoryMemory
()
...
...
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