jihuaqiang 5 days ago
parent
commit
12da3372e7
2 changed files with 7 additions and 1 deletions
  1. 4 1
      agent.py
  2. 3 0
      tools/agent_tools.py

+ 4 - 1
agent.py

@@ -220,12 +220,15 @@ def create_langgraph_workflow():
                     ok = affected is not None and affected > 0 and parsing_affected is not None and parsing_affected > 0
                     if ok:
                         success_count += 1
+                    else:
+                        success_count += 1
+                        logger.error(f"处理第 {idx} 项时出错: {identify_result.get('error') or structure_result.get('error')}")
                     
                     # 记录处理详情
                     detail = {
                         "index": idx,
                         "dbInserted": ok,
-                        "identifyError": identify_result.get('error'),
+                        "identifyError": identify_result.get('error') or structure_result.get('error'),
                         "status": 2 if ok else 3
                     }
                     details.append(detail)

+ 3 - 0
tools/agent_tools.py

@@ -320,6 +320,9 @@ class UpdateDataTool:
             
             # 状态:5 表示结构化处理完成
             status = 5
+            # 判断是否需要序列化为字符串
+            if isinstance(parsing_payload, (dict, list)):
+                parsing_payload = json.dumps(parsing_payload, ensure_ascii=False)
             params = (
                 parsing_payload,
                 status,