1. 修复论坛通信问题,基于日志块增加容错
2. 使用ERROR层级来避免json解析错误导致的连环问题
This commit is contained in:
@@ -87,7 +87,7 @@ class ReportStructureNode(StateMutationNode):
|
||||
report_structure = json.loads(cleaned_output)
|
||||
logger.info("JSON解析成功")
|
||||
except JSONDecodeError as e:
|
||||
logger.exception(f"JSON解析失败: {str(e)}")
|
||||
logger.error(f"JSON解析失败: {str(e)}")
|
||||
# 使用更强大的提取方法
|
||||
report_structure = extract_clean_response(cleaned_output)
|
||||
if "error" in report_structure:
|
||||
|
||||
@@ -101,7 +101,7 @@ class FirstSearchNode(BaseNode):
|
||||
result = json.loads(cleaned_output)
|
||||
logger.info("JSON解析成功")
|
||||
except JSONDecodeError as e:
|
||||
logger.exception(f"JSON解析失败: {str(e)}")
|
||||
logger.error(f"JSON解析失败: {str(e)}")
|
||||
# 使用更强大的提取方法
|
||||
result = extract_clean_response(cleaned_output)
|
||||
if "error" in result:
|
||||
@@ -236,7 +236,7 @@ class ReflectionNode(BaseNode):
|
||||
result = json.loads(cleaned_output)
|
||||
logger.info("JSON解析成功")
|
||||
except JSONDecodeError as e:
|
||||
logger.exception(f"JSON解析失败: {str(e)}")
|
||||
logger.error(f"JSON解析失败: {str(e)}")
|
||||
# 使用更强大的提取方法
|
||||
result = extract_clean_response(cleaned_output)
|
||||
if "error" in result:
|
||||
|
||||
@@ -138,7 +138,7 @@ class FirstSummaryNode(StateMutationNode):
|
||||
result = json.loads(cleaned_output)
|
||||
logger.info("JSON解析成功")
|
||||
except JSONDecodeError as e:
|
||||
logger.exception(f"JSON解析失败: {str(e)}")
|
||||
logger.error(f"JSON解析失败: {str(e)}")
|
||||
# 尝试修复JSON
|
||||
fixed_json = fix_incomplete_json(cleaned_output)
|
||||
if fixed_json:
|
||||
@@ -306,7 +306,7 @@ class ReflectionSummaryNode(StateMutationNode):
|
||||
result = json.loads(cleaned_output)
|
||||
logger.info("JSON解析成功")
|
||||
except JSONDecodeError as e:
|
||||
logger.exception(f"JSON解析失败: {str(e)}")
|
||||
logger.error(f"JSON解析失败: {str(e)}")
|
||||
# 尝试修复JSON
|
||||
fixed_json = fix_incomplete_json(cleaned_output)
|
||||
if fixed_json:
|
||||
@@ -314,11 +314,11 @@ class ReflectionSummaryNode(StateMutationNode):
|
||||
result = json.loads(fixed_json)
|
||||
logger.info("JSON修复成功")
|
||||
except JSONDecodeError:
|
||||
logger.exception("JSON修复失败,直接使用清理后的文本")
|
||||
logger.error("JSON修复失败,直接使用清理后的文本")
|
||||
# 如果不是JSON格式,直接返回清理后的文本
|
||||
return cleaned_output
|
||||
else:
|
||||
logger.exception("无法修复JSON,直接使用清理后的文本")
|
||||
logger.error("无法修复JSON,直接使用清理后的文本")
|
||||
# 如果不是JSON格式,直接返回清理后的文本
|
||||
return cleaned_output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user