- 新增后端完整业务支持:数据库模型、API接口、核心服务与RPA对接逻辑 - 新增前端工作台页面、路由适配与多语言国际化 - 新增Dify自定义工具OpenAPI规范、Agent配置脚本与部署文档 - 新增发货Excel模板生成脚本与默认模板 - 修复测试配置文件中的环境变量命名错误 - 更新本地开发环境变量配置
21 lines
620 B
Python
21 lines
620 B
Python
from __future__ import annotations
|
|
|
|
from app.models import Agent
|
|
|
|
EXTRACT_AGENT_NAME = "发货通知字段抽取"
|
|
CHAT_AGENT_NAME = "货代发货通知 Agent"
|
|
|
|
|
|
def resolve_extract_agent() -> Agent | None:
|
|
agent = Agent.query.filter_by(name=EXTRACT_AGENT_NAME, is_active=True).first()
|
|
if not agent or not agent.dify_api_key:
|
|
return None
|
|
app_type = (agent.extra_config or {}).get("dify_app_type")
|
|
if app_type and app_type != "workflow":
|
|
return None
|
|
return agent
|
|
|
|
|
|
def resolve_chat_agent() -> Agent | None:
|
|
return Agent.query.filter_by(name=CHAT_AGENT_NAME, is_active=True).first()
|