Commit 169532e1 by sunqi02

更新agent_id(agent_code),与调用测和注册端一直

1 parent c081f4f3
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
"agents": { "agents": {
"main": { "main": {
"name": "主 Agent", "name": "主 Agent",
"code": "100", "code": "11",
"role": "coordinator", "role": "coordinator",
"prompt_template": "你是{company}的智能助手,负责协调各个岗位Agent协作回答用户问题。\n\n## 核心规则(必须遵守)\n\n1. 当用户问题属于某个子Agent的职责范围时,你**必须调用 call_sub_agent 工具**来委托处理,**严禁**自己编造处理结果或口头描述\"正在处理\"。\n2. 收到子Agent返回结果后,直接整合回复用户,不要再次调用同一个子Agent。\n3. 只有当问题明确不属于任何子Agent职责时,才可以直接回答。\n\n## 可用子Agent(通过 call_sub_agent 调用)\n\n{duties}\n\n## 工具使用提醒\n\n你有一个 call_sub_agent(agent_code, instruction) 工具。用户不会看到你的内部思考过程,请直接用行动代替描述。", "prompt_template": "你是{company}的智能助手,负责协调各个岗位Agent协作回答用户问题。\n\n## 核心规则(必须遵守)\n\n1. 当用户问题属于某个子Agent的职责范围时,你**必须调用 call_sub_agent 工具**来委托处理,**严禁**自己编造处理结果或口头描述\"正在处理\"。\n2. 收到子Agent返回结果后,直接整合回复用户,不要再次调用同一个子Agent。\n3. 只有当问题明确不属于任何子Agent职责时,才可以直接回答。\n\n## 可用子Agent(通过 call_sub_agent 调用)\n\n{duties}\n\n## 工具使用提醒\n\n你有一个 call_sub_agent(agent_code, instruction) 工具。用户不会看到你的内部思考过程,请直接用行动代替描述。",
"skills": [] "skills": []
}, },
"meeting": { "meeting": {
"name": "会议纪要 Agent", "name": "会议纪要 Agent",
"code": "101", "code": "14",
"role": "会议纪要助手", "role": "会议纪要助手",
"prompt_template": "你是{company}的会议纪要助手,职责包括:{duties}。请根据用户的需求,帮助处理会议纪要相关的任务。", "prompt_template": "你是{company}的会议纪要助手,职责包括:{duties}。请根据用户的需求,帮助处理会议纪要相关的任务。",
"skills": ["meeting_minutes"] "skills": ["meeting_minutes"]
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
"group_name": "测试群" "group_name": "测试群"
}, },
"agents": [ "agents": [
{"agent_id": 100, "bot_id": "ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82", "is_steward": true}, {"agent_id": 11, "bot_id": "ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82", "is_steward": true},
{"agent_id": 101, "bot_id": "ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82", "is_steward": false} {"agent_id": 14, "bot_id": "ABE6E30E3476E955853410C13E38C1065194F219CF554649F1C4F9C615435A82", "is_steward": false}
], ],
"messages": [ "messages": [
{ {
......
...@@ -78,7 +78,7 @@ def _make_request( ...@@ -78,7 +78,7 @@ def _make_request(
"position_code": "store_sales", "position_code": "store_sales",
"position_name": "驻店销售岗", "position_name": "驻店销售岗",
}, },
"agents": agents or [{"agent_id": 101, "agent_name": "会议纪要 Agent"}], "agents": agents or [{"agent_id": 14, "agent_name": "会议纪要 Agent"}],
"messages": [ "messages": [
{ {
"msg_id": "m1", "msg_id": "m1",
...@@ -207,13 +207,13 @@ class TestChatCompletionsAPI: ...@@ -207,13 +207,13 @@ class TestChatCompletionsAPI:
"""agents 数组中的 agent_id 映射为 allowed_agent_codes""" """agents 数组中的 agent_id 映射为 allowed_agent_codes"""
with patch.object(test_hub, 'model', new=_make_mock_model_reply("回复")): with patch.object(test_hub, 'model', new=_make_mock_model_reply("回复")):
with patch.object(test_hub.formatter, 'format', new=AsyncMock(side_effect=_noop_format)): with patch.object(test_hub.formatter, 'format', new=AsyncMock(side_effect=_noop_format)):
# agents 中包含 agent_id=101(meeting agent) # agents 中包含 agent_id=14(meeting agent)
resp = client.post( resp = client.post(
"/api/v1/chat/completions", "/api/v1/chat/completions",
json=_make_request( json=_make_request(
group_contact_id="sess_agent_filter", group_contact_id="sess_agent_filter",
query="你好", query="你好",
agents=[{"agent_id": 101, "agent_name": "会议纪要 Agent"}], agents=[{"agent_id": 14, "agent_name": "会议纪要 Agent"}],
), ),
) )
...@@ -285,7 +285,7 @@ class TestChatCompletionsAPI: ...@@ -285,7 +285,7 @@ class TestChatCompletionsAPI:
"/api/v1/chat/completions", "/api/v1/chat/completions",
json={ json={
"group": {"group_contact_id": "grp_no_name"}, "group": {"group_contact_id": "grp_no_name"},
"agents": [{"agent_id": 101}], "agents": [{"agent_id": 14}],
"messages": [ "messages": [
{ {
"msg_id": "m1", "msg_id": "m1",
...@@ -309,7 +309,7 @@ class TestChatCompletionsAPI: ...@@ -309,7 +309,7 @@ class TestChatCompletionsAPI:
json={ json={
"group": {"group_contact_id": "grp_steward"}, "group": {"group_contact_id": "grp_steward"},
"agents": [ "agents": [
{"agent_id": 101, "bot_id": "bot_001", "is_steward": True}, {"agent_id": 14, "bot_id": "bot_001", "is_steward": True},
{"agent_id": 102, "bot_id": "bot_002", "is_steward": False}, {"agent_id": 102, "bot_id": "bot_002", "is_steward": False},
], ],
"messages": [ "messages": [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!