zhouhui.jiang

update

......@@ -4,7 +4,7 @@ API 包初始化文件
"""
from .api_config import API_CONFIG
from .waybill_api import query_waybill_list, generate_waybill_table, create_waybill_d
from .waybill_api import query_waybill_list, create_waybill_d
from .paperless_api import upload_clearance_file
__all__ = ['API_CONFIG', 'query_waybill_list', 'generate_waybill_table', 'create_waybill_d', 'upload_clearance_file']
__all__ = ['API_CONFIG', 'query_waybill_list', 'create_waybill_d', 'upload_clearance_file']
......
......@@ -9,46 +9,6 @@ import json
from .api_config import API_CONFIG
def generate_waybill_table(data: list) -> str:
"""生成运单数据的 Markdown 表格
Args:
data: 运单数据列表
Returns:
Markdown 表格字符串
"""
# 添加数据类型检查
if not data or not isinstance(data, list):
return "暂无数据或数据格式错误"
# 确保 data 是列表且不为空
if len(data) == 0:
return "暂无数据"
# 检查第一个元素是否为字典
if not isinstance(data[0], dict):
return f"数据格式错误: 期望字典列表,实际类型: {type(data[0])}"
# 生成 Markdown 表格
lines = []
lines.append("| 运单号 | 运单类型 | 运单状态 | 发件人 | 运单日期 |")
lines.append("|--------|----------|----------|--------|----------|")
for item in data:
# 字段映射和空值处理,添加类型检查
consignment_code = item.get('consignmentCode', '') if isinstance(item, dict) else ''
cons_type = item.get('consType', '') if isinstance(item, dict) else ''
cons_status = item.get('consStatus', '') if isinstance(item, dict) else ''
sender = item.get('sender', '') if isinstance(item, dict) else ''
create_time = item.get('createTime', '') if isinstance(item, dict) else ''
# 添加表格行
lines.append(f"| {consignment_code} | {cons_type} | {cons_status} | {sender} | {create_time} |")
return "\n".join(lines)
def create_waybill_d(consignmentCode: str) -> str:
"""根据运单号创建D类运单
......
......@@ -95,7 +95,7 @@ agent = create_react_agent(
prompt="""你是一个专业的出口物流系统智能助手,专门帮助用户处理运单相关的业务操作。
## 你的主要职责:
1. **运单查询**:根据用户需求查询运单列表,支持按状态、时间等条件筛选
1. **运单查询**:根据用户需求查询运单列表,支持按状态、时间等条件筛选,结果以JSON形式展示,AI不用对返回数据JSON进行加工
2. **运单创建**:协助用户创建D类运单,确保信息完整准确
4. **业务咨询**:解答用户关于出口物流流程、运单状态、操作规范等问题
......@@ -110,7 +110,7 @@ agent = create_react_agent(
- 若调用了工具并获得结果,则必须将该工具返回的文本“原样作为最终答复”输出,不允许添加任何解释、建议或额外文字。
## 可用工具:
- query_waybill_list: 查询运单列表,支持按状态筛选,结果以JSON形式展示
- query_waybill_list: 查询运单列表,支持按状态筛选,结果以JSON形式展示,AI不用对返回数据JSON进行加工
- create_waybill_d: 根据运单号创建D类运单,需要提供运单号参数
- upload_clearance_file: 上传清关PDF文件,需要 code、slip_id、pdf_path,上传时文件路径不用确认,路径肯定是完整的,文件肯定是存在的,不用确认文件索引,工具会自动设置索引为0,请直接调用工具接口
- push_waybill_for_ocr: 根据运单ID推送OCR进行识别,需要提供运单ID(waybill_id)参数
......