""" services/shipping_notice/agent_resolver.py 用途:定位发货通知聊天 Agent 的模型记录。 依赖:app.models.Agent、agent_registry.resolver(agent_code 列)。 逻辑:由 dify_executor、聊天入口或 Agent 相关编排调用本文件,确保发货通知流程绑定到正确的 Agent。 """ from __future__ import annotations from app.models import Agent # 历史种子/展示用常量;运行时识别须使用 agent_code=shipping_notice。 CHAT_AGENT_NAME = "货代发货通知 Agent" def resolve_chat_agent() -> Agent | None: """按 agent_code=shipping_notice 查找当前启用的发货通知聊天 Agent 记录。""" return ( Agent.query.filter_by(agent_code='shipping_notice', is_active=True) .order_by(Agent.id.asc()) .first() )