Showing
11 changed files
with
4 additions
and
44 deletions
No preview for this file type
No preview for this file type
This file is too large to display.
No preview for this file type
No preview for this file type
| ... | @@ -4,7 +4,7 @@ API 包初始化文件 | ... | @@ -4,7 +4,7 @@ API 包初始化文件 |
| 4 | """ | 4 | """ |
| 5 | 5 | ||
| 6 | from .api_config import API_CONFIG | 6 | from .api_config import API_CONFIG |
| 7 | -from .waybill_api import query_waybill_list, generate_waybill_table, create_waybill_d | 7 | +from .waybill_api import query_waybill_list, create_waybill_d |
| 8 | from .paperless_api import upload_clearance_file | 8 | from .paperless_api import upload_clearance_file |
| 9 | 9 | ||
| 10 | -__all__ = ['API_CONFIG', 'query_waybill_list', 'generate_waybill_table', 'create_waybill_d', 'upload_clearance_file'] | 10 | +__all__ = ['API_CONFIG', 'query_waybill_list', 'create_waybill_d', 'upload_clearance_file'] | ... | ... |
No preview for this file type
No preview for this file type
| ... | @@ -9,46 +9,6 @@ import json | ... | @@ -9,46 +9,6 @@ import json |
| 9 | from .api_config import API_CONFIG | 9 | from .api_config import API_CONFIG |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | -def generate_waybill_table(data: list) -> str: | ||
| 13 | - """生成运单数据的 Markdown 表格 | ||
| 14 | - | ||
| 15 | - Args: | ||
| 16 | - data: 运单数据列表 | ||
| 17 | - | ||
| 18 | - Returns: | ||
| 19 | - Markdown 表格字符串 | ||
| 20 | - """ | ||
| 21 | - # 添加数据类型检查 | ||
| 22 | - if not data or not isinstance(data, list): | ||
| 23 | - return "暂无数据或数据格式错误" | ||
| 24 | - | ||
| 25 | - # 确保 data 是列表且不为空 | ||
| 26 | - if len(data) == 0: | ||
| 27 | - return "暂无数据" | ||
| 28 | - | ||
| 29 | - # 检查第一个元素是否为字典 | ||
| 30 | - if not isinstance(data[0], dict): | ||
| 31 | - return f"数据格式错误: 期望字典列表,实际类型: {type(data[0])}" | ||
| 32 | - | ||
| 33 | - # 生成 Markdown 表格 | ||
| 34 | - lines = [] | ||
| 35 | - lines.append("| 运单号 | 运单类型 | 运单状态 | 发件人 | 运单日期 |") | ||
| 36 | - lines.append("|--------|----------|----------|--------|----------|") | ||
| 37 | - | ||
| 38 | - for item in data: | ||
| 39 | - # 字段映射和空值处理,添加类型检查 | ||
| 40 | - consignment_code = item.get('consignmentCode', '') if isinstance(item, dict) else '' | ||
| 41 | - cons_type = item.get('consType', '') if isinstance(item, dict) else '' | ||
| 42 | - cons_status = item.get('consStatus', '') if isinstance(item, dict) else '' | ||
| 43 | - sender = item.get('sender', '') if isinstance(item, dict) else '' | ||
| 44 | - create_time = item.get('createTime', '') if isinstance(item, dict) else '' | ||
| 45 | - | ||
| 46 | - # 添加表格行 | ||
| 47 | - lines.append(f"| {consignment_code} | {cons_type} | {cons_status} | {sender} | {create_time} |") | ||
| 48 | - | ||
| 49 | - return "\n".join(lines) | ||
| 50 | - | ||
| 51 | - | ||
| 52 | def create_waybill_d(consignmentCode: str) -> str: | 12 | def create_waybill_d(consignmentCode: str) -> str: |
| 53 | """根据运单号创建D类运单 | 13 | """根据运单号创建D类运单 |
| 54 | 14 | ... | ... |
No preview for this file type
| ... | @@ -95,7 +95,7 @@ agent = create_react_agent( | ... | @@ -95,7 +95,7 @@ agent = create_react_agent( |
| 95 | prompt="""你是一个专业的出口物流系统智能助手,专门帮助用户处理运单相关的业务操作。 | 95 | prompt="""你是一个专业的出口物流系统智能助手,专门帮助用户处理运单相关的业务操作。 |
| 96 | 96 | ||
| 97 | ## 你的主要职责: | 97 | ## 你的主要职责: |
| 98 | -1. **运单查询**:根据用户需求查询运单列表,支持按状态、时间等条件筛选 | 98 | +1. **运单查询**:根据用户需求查询运单列表,支持按状态、时间等条件筛选,结果以JSON形式展示,AI不用对返回数据JSON进行加工 |
| 99 | 2. **运单创建**:协助用户创建D类运单,确保信息完整准确 | 99 | 2. **运单创建**:协助用户创建D类运单,确保信息完整准确 |
| 100 | 4. **业务咨询**:解答用户关于出口物流流程、运单状态、操作规范等问题 | 100 | 4. **业务咨询**:解答用户关于出口物流流程、运单状态、操作规范等问题 |
| 101 | 101 | ||
| ... | @@ -110,7 +110,7 @@ agent = create_react_agent( | ... | @@ -110,7 +110,7 @@ agent = create_react_agent( |
| 110 | - 若调用了工具并获得结果,则必须将该工具返回的文本“原样作为最终答复”输出,不允许添加任何解释、建议或额外文字。 | 110 | - 若调用了工具并获得结果,则必须将该工具返回的文本“原样作为最终答复”输出,不允许添加任何解释、建议或额外文字。 |
| 111 | 111 | ||
| 112 | ## 可用工具: | 112 | ## 可用工具: |
| 113 | -- query_waybill_list: 查询运单列表,支持按状态筛选,结果以JSON形式展示 | 113 | +- query_waybill_list: 查询运单列表,支持按状态筛选,结果以JSON形式展示,AI不用对返回数据JSON进行加工 |
| 114 | - create_waybill_d: 根据运单号创建D类运单,需要提供运单号参数 | 114 | - create_waybill_d: 根据运单号创建D类运单,需要提供运单号参数 |
| 115 | - upload_clearance_file: 上传清关PDF文件,需要 code、slip_id、pdf_path,上传时文件路径不用确认,路径肯定是完整的,文件肯定是存在的,不用确认文件索引,工具会自动设置索引为0,请直接调用工具接口 | 115 | - upload_clearance_file: 上传清关PDF文件,需要 code、slip_id、pdf_path,上传时文件路径不用确认,路径肯定是完整的,文件肯定是存在的,不用确认文件索引,工具会自动设置索引为0,请直接调用工具接口 |
| 116 | - push_waybill_for_ocr: 根据运单ID推送OCR进行识别,需要提供运单ID(waybill_id)参数 | 116 | - push_waybill_for_ocr: 根据运单ID推送OCR进行识别,需要提供运单ID(waybill_id)参数 | ... | ... |
-
Please register or login to post a comment