feat(agent): 增强 Agent 配置,新增结构化字段与聊天功能支持

This commit is contained in:
hugo committed 2026-07-07 11:10:32 +08:00
1 parent ac4262cd75
commit c8ce77199e
183 files changed
+11690 -2300

No files matched your search

@@ -0,0 +1,32 @@
"""
tests/test_agent_registry_handlers.py
用途:ShippingNoticeHandler UI State 事件构造测试。
"""
from __future__ import annotations
from types import SimpleNamespace
from app.services.agent_registry.handlers.base import ChatStreamContext
from app.services.agent_registry.handlers.bootstrap import load_handlers
from app.services.agent_registry.handlers.registry import get_handler
def test_shipping_handler_builds_ui_state_event(app):
with app.app_context():
load_handlers()
handler = get_handler('shipping_notice')
assert handler is not None
ctx = ChatStreamContext(
query='test',
display_query='test',
user=SimpleNamespace(id=1),
agent=SimpleNamespace(agent_code='shipping_notice'),
session=SimpleNamespace(session_id='conv-1'),
external_conversation_id=None,
request_id='req-1',
shipping_task_id='SN-TEST-001',
shipping_batch_no='SB-TEST',
)
event = handler.build_ui_state_event(ctx)
assert event is None or event.get('event') == 'shipping_ui_state'