feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持
This commit is contained in:
1 parent
ac4262cd75
commit
c8ce77199e
183 files changed
+11690
-2300
No files matched your search
@@ -938,6 +938,12 @@ def test_workspace_shipping_ui_state_is_embedded_in_workspace_reads(app, client)
|
||||
batch_state = _unwrap_ok(batch_state_res)
|
||||
|
||||
assert task_state["checkpoint"] == "shortage_review"
|
||||
assert [item["id"] for item in task_state["action_buttons"]] == [
|
||||
"reparse_inventory",
|
||||
"rematch",
|
||||
"reject",
|
||||
]
|
||||
assert "correct_inventory_mapping" not in [item["id"] for item in task_state["action_buttons"]]
|
||||
assert task_detail["ui_state"]["action_buttons"] == task_state["action_buttons"]
|
||||
assert task_state["current_step"]["status"] == "blocked"
|
||||
assert batch_detail["focus_task_ui_state"]["task_no"] == "SN-UI-STATE-001"
|
||||
@@ -959,6 +965,9 @@ def test_chat_completions_streams_shipping_ui_state(app, client, monkeypatch):
|
||||
user.set_password("password")
|
||||
agent = Agent(
|
||||
name="货代发货通知 Agent",
|
||||
agent_code="shipping_notice",
|
||||
runtime_provider="hybrid",
|
||||
conversation_mode="task_chat",
|
||||
dify_api_key="test-dify-key",
|
||||
api_base_url="http://dify.example/v1",
|
||||
type="api",
|
||||
@@ -1610,12 +1619,21 @@ def test_build_dify_chat_inputs_does_not_fallback_to_latest_task_without_explici
|
||||
assert runtime_context["refs"] == {"run_purpose": "chat_turn"}
|
||||
|
||||
|
||||
def test_is_shipping_notice_chat_agent_accepts_current_dify_app_name():
|
||||
"""兼容 Dify 侧当前使用的智能发货通知Agent命名。"""
|
||||
def test_shipping_notice_agent_code_from_resolver():
|
||||
"""发货通知识别应基于 resolve_agent_code,不再提供 dify_inputs 名称启发式。"""
|
||||
from app.services.agent_registry.resolver import resolve_agent_code
|
||||
|
||||
class AgentLike:
|
||||
name = "智能发货通知Agent"
|
||||
agent_code = "shipping_notice"
|
||||
|
||||
assert dify_inputs.is_shipping_notice_chat_agent(AgentLike()) is True
|
||||
assert resolve_agent_code(AgentLike()) == "shipping_notice"
|
||||
|
||||
class GenericLike:
|
||||
name = "智能发货通知Agent"
|
||||
agent_code = "generic"
|
||||
|
||||
assert resolve_agent_code(GenericLike()) != "shipping_notice"
|
||||
|
||||
|
||||
def test_create_empty_batch_returns_batch_shell(app, client):
|
||||
|
||||
Reference in new issue
Block a user