fix: 修复技术目录生成Agent中的NoneType错误

- 修复safe_execute方法中的None返回值处理
- 增强所有NodeStateManager方法的None状态处理
- 确保状态管理方法始终返回有效的字典对象
- 增加错误情况下的降级处理和日志记录

修复了重构过程中引入的'NoneType' object does not support item assignment错误

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-29 11:25:35 +08:00
parent b5b727a61d
commit c96c3696ca
14 changed files with 347 additions and 1239 deletions

View File

@ -1,548 +0,0 @@
{
"project_name": "111",
"source_file": "C:\\Users\\sladr\\Downloads\\test2.docx",
"success": true,
"technical_count": 19,
"commercial_count": 12,
"deviation_count": 0,
"chapter_count": 6,
"execution_time": 192.46280717849731,
"warnings": [
"AI审查: 6条优化建议"
],
"bid_structure": {
"scoring_criteria": [
{
"item_name": "供应商名称",
"max_score": 0.0,
"description": "生产厂商名称与营业执照、资质证书一致;代理商名称与营业执照、获得制造商授权代理的公司名称一致",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "响应文件的签署",
"max_score": 0.0,
"description": "有法定代表人或其委托代理人签字并加盖单位章",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "响应文件格式",
"max_score": 0.0,
"description": "符合\"响应文件格式\"的要求",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "营业执照",
"max_score": 0.0,
"description": "供应商须具有工商行政主管部门核发的有效法人营业执照,提供营业执照原件扫描件",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "资质要求",
"max_score": 0.0,
"description": "符合第一章\"供应商资格要求\"规定",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "利益冲突",
"max_score": 0.0,
"description": "单位负责人为同一人或者存在控股、管理关系的不同单位,不得同时参加同一标段响应或者未划分标段的同一磋商项目响应;与采购当事人存在利害关系可能影响磋商公正性的法人、其他组织或者个人,不得参加响应",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "联合体供应商",
"max_score": 0.0,
"description": "符合第二章\"供应商须知\"第1.4.2项规定",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "不存在禁止响应的情形",
"max_score": 0.0,
"description": "不存在第二章\"供应商须知\"第1.4.3项规定的任何一种情形",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "响应内容",
"max_score": 0.0,
"description": "符合第二章\"供应商须知\"项规定",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "技术性能指标",
"max_score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定",
"category": "equipment_spec",
"chapter_id": "chapter_02_equipment_spec"
},
{
"item_name": "权利义务",
"max_score": 0.0,
"description": "符合第二章\"供应商须知\"规定和第五章\"合同主要条款\"中的实质性要求和条件",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
},
{
"item_name": "响应设备及技术服务和质保服务",
"max_score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定和第五章\"合同主要条款\"中的实质性要求和条件",
"category": "after_sales",
"chapter_id": "chapter_03_after_sales"
},
{
"item_name": "技术支持资料",
"max_score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定",
"category": "after_sales",
"chapter_id": "chapter_03_after_sales"
},
{
"item_name": "质保期",
"max_score": 3.0,
"description": "售后质保期2年得1分。售后质保期延长至3年得2分。售后质保期延长至4年得3分。",
"category": "after_sales",
"chapter_id": "chapter_03_after_sales"
},
{
"item_name": "硬件配置",
"max_score": 8.0,
"description": "以确保设备性配置不低于招标文件硬件配置要求。打分标准设备硬件的品牌、硬件配置高低、技术先进性、稳定性、兼容性以及售后服务质量等每项指标综合打分。硬件未满足技术要求按每1项不满足扣1分扣完为止。招标文件中参数要求提供的检测报告、功能截图、证书等证明材料供应商必须按要求提供否则评委不予采信",
"category": "equipment_spec",
"chapter_id": "chapter_02_equipment_spec"
},
{
"item_name": "软件功能",
"max_score": 8.0,
"description": "应按照磋商文件功能要求实现各项软件功能完成率软件功能按每1项不满足扣1分扣完为止。",
"category": "technical_solution",
"chapter_id": "chapter_04_technical_solution"
},
{
"item_name": "系统架构",
"max_score": 5.0,
"description": "对系统架构、实施内容、技术特点、安装规范、售后服务等方面进行说明缺少1项扣1分扣完为止。",
"category": "technical_solution",
"chapter_id": "chapter_04_technical_solution"
},
{
"item_name": "网路安全防护",
"max_score": 5.0,
"description": "1.防火墙配置、入侵检测系统、安全更新和补丁管理、用户权限管理、安全培训和意识提升、数据加密根据以上各项内容的打分情况可以综合评估组织的网络安全防护水平缺少1项扣1分扣完为止。",
"category": "quality_safety",
"chapter_id": "chapter_05_quality_safety"
},
{
"item_name": "技术实力",
"max_score": 3.0,
"description": "投标人具有自主研发的实时视频分析平台系统的知识产权和AI识别方法的发明专利每提供一个得1分共3分。提供证书原件的扫描件并加盖公章",
"category": "compliance",
"chapter_id": "chapter_01_compliance"
}
],
"deviation_items": [],
"chapters": [
{
"id": "evaluation_index",
"title": "评标索引表(技术评分完全对应)",
"level": 1,
"score": null,
"template_placeholder": "{{evaluation_index_content}}",
"children": []
},
{
"id": "chapter_01_compliance",
"title": "合规响应 (3.0分)",
"level": 1,
"score": 3.0,
"template_placeholder": "{{chapter_01_compliance_content}}",
"children": [
{
"id": "chapter_01_compliance_sub_01",
"title": "供应商基本信息",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_01_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_02",
"title": "响应文件签署确认",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_02_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_03",
"title": "响应文件格式规范",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_03_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_04",
"title": "营业执照及资质证明",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_04_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_05",
"title": "专业资质要求响应",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_05_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_06",
"title": "利益冲突声明",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_06_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_07",
"title": "联合体供应商说明",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_07_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_08",
"title": "禁止响应情形声明",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_08_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_09",
"title": "响应内容完整性",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_09_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_10",
"title": "权利义务确认",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_01_compliance_sub_10_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_11",
"title": "技术实力证明",
"level": 2,
"score": 3.0,
"template_placeholder": "{{chapter_01_compliance_sub_11_content}}",
"children": [
{
"id": "chapter_01_compliance_sub_11_01",
"title": "技术团队配置与经验",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_01_compliance_sub_11_01_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_11_02",
"title": "技术设备与资源保障",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_01_compliance_sub_11_02_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_11_03",
"title": "技术研发能力展示",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_01_compliance_sub_11_03_content}}",
"children": []
},
{
"id": "chapter_01_compliance_sub_11_04",
"title": "技术服务质量保证",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_01_compliance_sub_11_04_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_02_equipment_spec",
"title": "设备规格 (8.0分)",
"level": 1,
"score": 8.0,
"template_placeholder": "{{chapter_02_equipment_spec_content}}",
"children": [
{
"id": "chapter_02_equipment_spec_sub_01",
"title": "技术性能指标",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_02",
"title": "硬件配置",
"level": 2,
"score": 8.0,
"template_placeholder": "{{chapter_02_equipment_spec_sub_02_content}}",
"children": [
{
"id": "chapter_02_equipment_spec_sub_02_01",
"title": "核心硬件组件配置",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_02_01_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_02_02",
"title": "硬件性能参数说明",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_02_02_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_02_03",
"title": "硬件兼容性与扩展性",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_02_03_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_02_04",
"title": "硬件质量保证措施",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_02_04_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_03_after_sales",
"title": "售后服务 (3.0分)",
"level": 1,
"score": 3.0,
"template_placeholder": "{{chapter_03_after_sales_content}}",
"children": [
{
"id": "chapter_03_after_sales_sub_01",
"title": "响应设备及技术服务和质保服务",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_03_after_sales_sub_01_content}}",
"children": []
},
{
"id": "chapter_03_after_sales_sub_02",
"title": "技术支持资料",
"level": 2,
"score": 0.0,
"template_placeholder": "{{chapter_03_after_sales_sub_02_content}}",
"children": []
},
{
"id": "chapter_03_after_sales_sub_03",
"title": "质保期",
"level": 2,
"score": 3.0,
"template_placeholder": "{{chapter_03_after_sales_sub_03_content}}",
"children": [
{
"id": "chapter_03_after_sales_sub_03_01",
"title": "质保期限承诺",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_after_sales_sub_03_01_content}}",
"children": []
},
{
"id": "chapter_03_after_sales_sub_03_02",
"title": "质保服务范围",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_after_sales_sub_03_02_content}}",
"children": []
},
{
"id": "chapter_03_after_sales_sub_03_03",
"title": "质保期服务响应机制",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_after_sales_sub_03_03_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_04_technical_solution",
"title": "技术方案 (13.0分)",
"level": 1,
"score": 13.0,
"template_placeholder": "{{chapter_04_technical_solution_content}}",
"children": [
{
"id": "chapter_04_technical_solution_sub_01",
"title": "软件功能设计",
"level": 2,
"score": 8.0,
"template_placeholder": "{{chapter_04_technical_solution_sub_01_content}}",
"children": [
{
"id": "chapter_04_technical_solution_sub_01_01",
"title": "核心功能模块设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_04_technical_solution_sub_01_02",
"title": "用户交互界面设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_04_technical_solution_sub_01_03",
"title": "数据处理功能设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_04_technical_solution_sub_01_04",
"title": "系统管理功能设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_01_04_content}}",
"children": []
}
]
},
{
"id": "chapter_04_technical_solution_sub_02",
"title": "系统架构设计",
"level": 2,
"score": 5.0,
"template_placeholder": "{{chapter_04_technical_solution_sub_02_content}}",
"children": [
{
"id": "chapter_04_technical_solution_sub_02_01",
"title": "总体架构设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_02_01_content}}",
"children": []
},
{
"id": "chapter_04_technical_solution_sub_02_02",
"title": "技术架构选型",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_02_02_content}}",
"children": []
},
{
"id": "chapter_04_technical_solution_sub_02_03",
"title": "系统部署架构",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_technical_solution_sub_02_03_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_05_quality_safety",
"title": "质量安全 (5.0分)",
"level": 1,
"score": 5.0,
"template_placeholder": "{{chapter_05_quality_safety_content}}",
"children": [
{
"id": "chapter_05_quality_safety_sub_01",
"title": "网络安全防护体系",
"level": 2,
"score": 5.0,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_content}}",
"children": [
{
"id": "chapter_05_quality_safety_sub_01_01",
"title": "网络边界安全防护",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_05_quality_safety_sub_01_02",
"title": "入侵检测与防御系统",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_05_quality_safety_sub_01_03",
"title": "网络安全审计与监控",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_05_quality_safety_sub_01_04",
"title": "网络访问控制策略",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_04_content}}",
"children": []
},
{
"id": "chapter_05_quality_safety_sub_01_05",
"title": "网络安全应急预案",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_quality_safety_sub_01_05_content}}",
"children": []
}
]
}
]
}
]
}
}

View File

@ -1,211 +0,0 @@
[
{
"id": 1,
"title": "供应商名称",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "生产厂商名称与营业执照、资质证书一致;代理商名称与营业执照、获得制造商授权代理的公司名称一致",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 2,
"title": "响应文件的签署",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "有法定代表人或其委托代理人签字并加盖单位章",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 3,
"title": "响应文件格式",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "符合\"响应文件格式\"的要求",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 4,
"title": "营业执照",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "供应商须具有工商行政主管部门核发的有效法人营业执照,提供营业执照原件扫描件",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 5,
"title": "资质要求",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "符合第一章\"供应商资格要求\"规定",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 6,
"title": "利益冲突",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "单位负责人为同一人或者存在控股、管理关系的不同单位,不得同时参加同一标段响应或者未划分标段的同一磋商项目响应;与采购当事人存在利害关系可能影响磋商公正性的法人、其他组织或者个人,不得参加响应",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 7,
"title": "联合体供应商",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "符合第二章\"供应商须知\"第1.4.2项规定",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 8,
"title": "不存在禁止响应的情形",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "不存在第二章\"供应商须知\"第1.4.3项规定的任何一种情形",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 9,
"title": "响应内容",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "符合第二章\"供应商须知\"项规定",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 10,
"title": "技术性能指标",
"chapter_id": "chapter_02_equipment_spec",
"score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定",
"category": "equipment_spec",
"status": "pending",
"content": "",
"placeholder": "{{chapter_02_equipment_spec_content}}"
},
{
"id": 11,
"title": "权利义务",
"chapter_id": "chapter_01_compliance",
"score": 0.0,
"description": "符合第二章\"供应商须知\"规定和第五章\"合同主要条款\"中的实质性要求和条件",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
},
{
"id": 12,
"title": "响应设备及技术服务和质保服务",
"chapter_id": "chapter_03_after_sales",
"score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定和第五章\"合同主要条款\"中的实质性要求和条件",
"category": "after_sales",
"status": "pending",
"content": "",
"placeholder": "{{chapter_03_after_sales_content}}"
},
{
"id": 13,
"title": "技术支持资料",
"chapter_id": "chapter_03_after_sales",
"score": 0.0,
"description": "符合第三章\"采购需求及技术要求\"规定",
"category": "after_sales",
"status": "pending",
"content": "",
"placeholder": "{{chapter_03_after_sales_content}}"
},
{
"id": 14,
"title": "质保期",
"chapter_id": "chapter_03_after_sales",
"score": 3.0,
"description": "售后质保期2年得1分。售后质保期延长至3年得2分。售后质保期延长至4年得3分。",
"category": "after_sales",
"status": "pending",
"content": "",
"placeholder": "{{chapter_03_after_sales_content}}"
},
{
"id": 15,
"title": "硬件配置",
"chapter_id": "chapter_02_equipment_spec",
"score": 8.0,
"description": "以确保设备性配置不低于招标文件硬件配置要求。打分标准设备硬件的品牌、硬件配置高低、技术先进性、稳定性、兼容性以及售后服务质量等每项指标综合打分。硬件未满足技术要求按每1项不满足扣1分扣完为止。招标文件中参数要求提供的检测报告、功能截图、证书等证明材料供应商必须按要求提供否则评委不予采信",
"category": "equipment_spec",
"status": "pending",
"content": "",
"placeholder": "{{chapter_02_equipment_spec_content}}"
},
{
"id": 16,
"title": "软件功能",
"chapter_id": "chapter_04_technical_solution",
"score": 8.0,
"description": "应按照磋商文件功能要求实现各项软件功能完成率软件功能按每1项不满足扣1分扣完为止。",
"category": "technical_solution",
"status": "pending",
"content": "",
"placeholder": "{{chapter_04_technical_solution_content}}"
},
{
"id": 17,
"title": "系统架构",
"chapter_id": "chapter_04_technical_solution",
"score": 5.0,
"description": "对系统架构、实施内容、技术特点、安装规范、售后服务等方面进行说明缺少1项扣1分扣完为止。",
"category": "technical_solution",
"status": "pending",
"content": "",
"placeholder": "{{chapter_04_technical_solution_content}}"
},
{
"id": 18,
"title": "网路安全防护",
"chapter_id": "chapter_05_quality_safety",
"score": 5.0,
"description": "1.防火墙配置、入侵检测系统、安全更新和补丁管理、用户权限管理、安全培训和意识提升、数据加密根据以上各项内容的打分情况可以综合评估组织的网络安全防护水平缺少1项扣1分扣完为止。",
"category": "quality_safety",
"status": "pending",
"content": "",
"placeholder": "{{chapter_05_quality_safety_content}}"
},
{
"id": 19,
"title": "技术实力",
"chapter_id": "chapter_01_compliance",
"score": 3.0,
"description": "投标人具有自主研发的实时视频分析平台系统的知识产权和AI识别方法的发明专利每提供一个得1分共3分。提供证书原件的扫描件并加盖公章",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_compliance_content}}"
}
]

View File

@ -1,361 +0,0 @@
{
"project_name": "222",
"source_file": "C:\\Users\\sladr\\Downloads\\test2.docx",
"success": true,
"technical_count": 6,
"commercial_count": 3,
"deviation_count": 0,
"chapter_count": 6,
"execution_time": 166.37327432632446,
"warnings": [
"AI审查: 4条优化建议"
],
"bid_structure": {
"scoring_criteria": [
{
"item_name": "质保期",
"max_score": 3.0,
"description": "售后质保期2年得1分。售后质保期延长至3年得2分。售后质保期延长至4年得3分。",
"category": "after_sales",
"chapter_id": "chapter_01_after_sales"
},
{
"item_name": "硬件配置",
"max_score": 8.0,
"description": "以确保设备性配置不低于招标文件硬件配置要求。打分标准设备硬件的品牌、硬件配置高低、技术先进性、稳定性、兼容性以及售后服务质量等每项指标综合打分。硬件未满足技术要求按每1项不满足扣1分扣完为止。招标文件中参数要求提供的检测报告、功能截图、证书等证明材料供应商必须按要求提供否则评委不予采信",
"category": "equipment_spec",
"chapter_id": "chapter_02_equipment_spec"
},
{
"item_name": "软件功能",
"max_score": 8.0,
"description": "应按照磋商文件功能要求实现各项软件功能完成率软件功能按每1项不满足扣1分扣完为止。",
"category": "technical_solution",
"chapter_id": "chapter_03_technical_solution"
},
{
"item_name": "系统架构",
"max_score": 5.0,
"description": "对系统架构、实施内容、技术特点、安装规范、售后服务等方面进行说明缺少1项扣1分扣完为止。",
"category": "technical_solution",
"chapter_id": "chapter_03_technical_solution"
},
{
"item_name": "网路安全防护",
"max_score": 5.0,
"description": "1.防火墙配置、入侵检测系统、安全更新和补丁管理、用户权限管理、安全培训和意识提升、数据加密根据以上各项内容的打分情况可以综合评估组织的网络安全防护水平缺少1项扣1分扣完为止。",
"category": "quality_safety",
"chapter_id": "chapter_04_quality_safety"
},
{
"item_name": "技术实力",
"max_score": 3.0,
"description": "投标人具有自主研发的实时视频分析平台系统的知识产权和AI识别方法的发明专利每提供一个得1分共3分。提供证书原件的扫描件并加盖公章",
"category": "compliance",
"chapter_id": "chapter_05_compliance"
}
],
"deviation_items": [],
"chapters": [
{
"id": "evaluation_index",
"title": "评标索引表(技术评分完全对应)",
"level": 1,
"score": null,
"template_placeholder": "{{evaluation_index_content}}",
"children": []
},
{
"id": "chapter_01_after_sales",
"title": "售后服务 (3.0分)",
"level": 1,
"score": 3.0,
"template_placeholder": "{{chapter_01_after_sales_content}}",
"children": [
{
"id": "chapter_01_after_sales_sub_01",
"title": "售后服务承诺",
"level": 2,
"score": 3.0,
"template_placeholder": "{{chapter_01_after_sales_sub_01_content}}",
"children": [
{
"id": "chapter_01_after_sales_sub_01_01",
"title": "质保期承诺",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_01_after_sales_sub_01_01_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_02_equipment_spec",
"title": "设备规格 (8.0分)",
"level": 1,
"score": 8.0,
"template_placeholder": "{{chapter_02_equipment_spec_content}}",
"children": [
{
"id": "chapter_02_equipment_spec_sub_01",
"title": "硬件配置",
"level": 2,
"score": 8.0,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_content}}",
"children": [
{
"id": "chapter_02_equipment_spec_sub_01_01",
"title": "服务器硬件配置",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_01_02",
"title": "存储设备配置",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_01_03",
"title": "网络设备配置",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_01_04",
"title": "安全设备配置",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_04_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_01_05",
"title": "硬件性能参数",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_05_content}}",
"children": []
},
{
"id": "chapter_02_equipment_spec_sub_01_06",
"title": "硬件兼容性说明",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_02_equipment_spec_sub_01_06_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_03_technical_solution",
"title": "技术方案 (13.0分)",
"level": 1,
"score": 13.0,
"template_placeholder": "{{chapter_03_technical_solution_content}}",
"children": [
{
"id": "chapter_03_technical_solution_sub_01",
"title": "软件功能设计",
"level": 2,
"score": 8.0,
"template_placeholder": "{{chapter_03_technical_solution_sub_01_content}}",
"children": [
{
"id": "chapter_03_technical_solution_sub_01_01",
"title": "核心功能模块设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_01_02",
"title": "用户交互功能设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_01_03",
"title": "数据处理功能设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_01_04",
"title": "系统管理功能设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_01_04_content}}",
"children": []
}
]
},
{
"id": "chapter_03_technical_solution_sub_02",
"title": "系统架构设计",
"level": 2,
"score": 5.0,
"template_placeholder": "{{chapter_03_technical_solution_sub_02_content}}",
"children": [
{
"id": "chapter_03_technical_solution_sub_02_01",
"title": "总体架构设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_02_01_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_02_02",
"title": "技术架构选型",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_02_02_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_02_03",
"title": "系统部署架构",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_02_03_content}}",
"children": []
},
{
"id": "chapter_03_technical_solution_sub_02_04",
"title": "安全架构设计",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_03_technical_solution_sub_02_04_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_04_quality_safety",
"title": "质量安全 (5.0分)",
"level": 1,
"score": 5.0,
"template_placeholder": "{{chapter_04_quality_safety_content}}",
"children": [
{
"id": "chapter_04_quality_safety_sub_01",
"title": "网络安全防护体系",
"level": 2,
"score": 5.0,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_content}}",
"children": [
{
"id": "chapter_04_quality_safety_sub_01_01",
"title": "网络边界安全防护",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_04_quality_safety_sub_01_02",
"title": "入侵检测与防御系统",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_04_quality_safety_sub_01_03",
"title": "网络访问控制策略",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_04_quality_safety_sub_01_04",
"title": "网络安全审计与监控",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_04_content}}",
"children": []
},
{
"id": "chapter_04_quality_safety_sub_01_05",
"title": "网络安全应急响应机制",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_04_quality_safety_sub_01_05_content}}",
"children": []
}
]
}
]
},
{
"id": "chapter_05_compliance",
"title": "合规响应 (3.0分)",
"level": 1,
"score": 3.0,
"template_placeholder": "{{chapter_05_compliance_content}}",
"children": [
{
"id": "chapter_05_compliance_sub_01",
"title": "技术实力",
"level": 2,
"score": 3.0,
"template_placeholder": "{{chapter_05_compliance_sub_01_content}}",
"children": [
{
"id": "chapter_05_compliance_sub_01_01",
"title": "核心技术团队介绍",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_compliance_sub_01_01_content}}",
"children": []
},
{
"id": "chapter_05_compliance_sub_01_02",
"title": "技术研发能力展示",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_compliance_sub_01_02_content}}",
"children": []
},
{
"id": "chapter_05_compliance_sub_01_03",
"title": "技术解决方案优势",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_compliance_sub_01_03_content}}",
"children": []
},
{
"id": "chapter_05_compliance_sub_01_04",
"title": "技术实施保障措施",
"level": 3,
"score": null,
"template_placeholder": "{{chapter_05_compliance_sub_01_04_content}}",
"children": []
}
]
}
]
}
]
}
}

View File

@ -1,68 +0,0 @@
[
{
"id": 1,
"title": "质保期",
"chapter_id": "chapter_01_after_sales",
"score": 3.0,
"description": "售后质保期2年得1分。售后质保期延长至3年得2分。售后质保期延长至4年得3分。",
"category": "after_sales",
"status": "pending",
"content": "",
"placeholder": "{{chapter_01_after_sales_content}}"
},
{
"id": 2,
"title": "硬件配置",
"chapter_id": "chapter_02_equipment_spec",
"score": 8.0,
"description": "以确保设备性配置不低于招标文件硬件配置要求。打分标准设备硬件的品牌、硬件配置高低、技术先进性、稳定性、兼容性以及售后服务质量等每项指标综合打分。硬件未满足技术要求按每1项不满足扣1分扣完为止。招标文件中参数要求提供的检测报告、功能截图、证书等证明材料供应商必须按要求提供否则评委不予采信",
"category": "equipment_spec",
"status": "pending",
"content": "",
"placeholder": "{{chapter_02_equipment_spec_content}}"
},
{
"id": 3,
"title": "软件功能",
"chapter_id": "chapter_03_technical_solution",
"score": 8.0,
"description": "应按照磋商文件功能要求实现各项软件功能完成率软件功能按每1项不满足扣1分扣完为止。",
"category": "technical_solution",
"status": "pending",
"content": "",
"placeholder": "{{chapter_03_technical_solution_content}}"
},
{
"id": 4,
"title": "系统架构",
"chapter_id": "chapter_03_technical_solution",
"score": 5.0,
"description": "对系统架构、实施内容、技术特点、安装规范、售后服务等方面进行说明缺少1项扣1分扣完为止。",
"category": "technical_solution",
"status": "pending",
"content": "",
"placeholder": "{{chapter_03_technical_solution_content}}"
},
{
"id": 5,
"title": "网路安全防护",
"chapter_id": "chapter_04_quality_safety",
"score": 5.0,
"description": "1.防火墙配置、入侵检测系统、安全更新和补丁管理、用户权限管理、安全培训和意识提升、数据加密根据以上各项内容的打分情况可以综合评估组织的网络安全防护水平缺少1项扣1分扣完为止。",
"category": "quality_safety",
"status": "pending",
"content": "",
"placeholder": "{{chapter_04_quality_safety_content}}"
},
{
"id": 6,
"title": "技术实力",
"chapter_id": "chapter_05_compliance",
"score": 3.0,
"description": "投标人具有自主研发的实时视频分析平台系统的知识产权和AI识别方法的发明专利每提供一个得1分共3分。提供证书原件的扫描件并加盖公章",
"category": "compliance",
"status": "pending",
"content": "",
"placeholder": "{{chapter_05_compliance_content}}"
}
]

View File

@ -16,7 +16,7 @@ from pydantic import BaseModel, Field
from ..tools.parser import BidParser, BidStructure, ScoringCriteria, DeviationItem, DocumentChapter from ..tools.parser import BidParser, BidStructure, ScoringCriteria, DeviationItem, DocumentChapter
from ..config import get_settings from ..config import get_settings
from ..nodes.toc.workflow_utils import should_continue_workflow from ..nodes.toc.base_mixins import WorkflowUtilsMixin
from .base import BaseAgentFactory from .base import BaseAgentFactory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -394,7 +394,7 @@ class AnalysisAgent(BaseAgentFactory):
# 添加条件边 # 添加条件边
workflow.add_conditional_edges( workflow.add_conditional_edges(
"validate_file", "validate_file",
should_continue_workflow, WorkflowUtilsMixin.should_continue_workflow,
{ {
"continue": "extract_tables", "continue": "extract_tables",
"end": END "end": END
@ -403,7 +403,7 @@ class AnalysisAgent(BaseAgentFactory):
workflow.add_conditional_edges( workflow.add_conditional_edges(
"extract_tables", "extract_tables",
should_continue_workflow, WorkflowUtilsMixin.should_continue_workflow,
{ {
"continue": "classify_tables", "continue": "classify_tables",
"end": END "end": END
@ -412,7 +412,7 @@ class AnalysisAgent(BaseAgentFactory):
workflow.add_conditional_edges( workflow.add_conditional_edges(
"classify_tables", "classify_tables",
should_continue_workflow, WorkflowUtilsMixin.should_continue_workflow,
{ {
"continue": "parse_content", "continue": "parse_content",
"end": END "end": END
@ -421,7 +421,7 @@ class AnalysisAgent(BaseAgentFactory):
workflow.add_conditional_edges( workflow.add_conditional_edges(
"parse_content", "parse_content",
should_continue_workflow, WorkflowUtilsMixin.should_continue_workflow,
{ {
"continue": "generate_toc", "continue": "generate_toc",
"end": END "end": END
@ -430,7 +430,7 @@ class AnalysisAgent(BaseAgentFactory):
workflow.add_conditional_edges( workflow.add_conditional_edges(
"generate_toc", "generate_toc",
should_continue_workflow, WorkflowUtilsMixin.should_continue_workflow,
{ {
"continue": "finalize_structure", "continue": "finalize_structure",
"end": END "end": END

View File

@ -16,13 +16,13 @@ from ...nodes.toc import (
ReviewStructureNode, ReviewStructureNode,
FinalizeChaptersNode FinalizeChaptersNode
) )
from ...nodes.toc.workflow_utils import should_continue_workflow from ...nodes.toc.base_mixins import WorkflowUtilsMixin
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# 使用通用的工作流条件判断函数 # 使用通用的工作流条件判断函数
should_continue = should_continue_workflow should_continue = WorkflowUtilsMixin.should_continue_workflow
class TocAgentBuilder(AgentBuilder): class TocAgentBuilder(AgentBuilder):

View File

@ -14,6 +14,12 @@ from .finalize_chapters import FinalizeChaptersNode
from .factories import ChapterFactory from .factories import ChapterFactory
from .category_manager import CategoryManager from .category_manager import CategoryManager
from .llm_helper import LLMHelper from .llm_helper import LLMHelper
from .base_mixins import (
NodeStateManager,
ErrorHandlerMixin,
WorkflowUtilsMixin,
TocNodeBase
)
__all__ = [ __all__ = [
# 核心节点 # 核心节点
@ -26,5 +32,11 @@ __all__ = [
# 辅助组件 # 辅助组件
"ChapterFactory", "ChapterFactory",
"CategoryManager", "CategoryManager",
"LLMHelper" "LLMHelper",
# 基础类和混入
"NodeStateManager",
"ErrorHandlerMixin",
"WorkflowUtilsMixin",
"TocNodeBase"
] ]

View File

@ -0,0 +1,216 @@
"""TOC节点基础混入类
提供统一的状态管理错误处理和工作流工具
"""
import logging
from abc import ABC
from typing import Dict, Any, Optional, Callable
logger = logging.getLogger(__name__)
class NodeStateManager:
"""节点状态管理器
统一管理节点执行过程中的状态更新逻辑
"""
@staticmethod
def update_progress(state: Dict[str, Any],
step_name: str,
progress: float) -> Dict[str, Any]:
"""更新节点执行进度
Args:
state: 当前状态字典
step_name: 步骤名称
progress: 进度值 (0.0-1.0)
Returns:
更新后的状态字典
"""
if state is None:
state = {}
state["current_step"] = step_name
state["progress"] = progress
if not state.get("error"):
state["should_continue"] = True
return state
@staticmethod
def set_error(state: Dict[str, Any], error_message: str) -> Dict[str, Any]:
"""设置错误状态
Args:
state: 当前状态字典
error_message: 错误消息
Returns:
更新后的状态字典
"""
if state is None:
state = {}
state["error"] = error_message
state["should_continue"] = False
return state
@staticmethod
def add_warning(state: Dict[str, Any], warning_message: str) -> Dict[str, Any]:
"""添加警告信息
Args:
state: 当前状态字典
warning_message: 警告消息
Returns:
更新后的状态字典
"""
if state is None:
state = {}
if "warnings" not in state:
state["warnings"] = []
state["warnings"].append(warning_message)
return state
@staticmethod
def complete_step(state: Dict[str, Any], **data_updates) -> Dict[str, Any]:
"""完成步骤并更新数据
Args:
state: 当前状态字典
**data_updates: 要更新的数据字段
Returns:
更新后的状态字典
"""
if state is None:
state = {}
state.update(data_updates)
return state
class ErrorHandlerMixin:
"""错误处理混入类
提供统一的异常处理和日志记录
"""
def safe_execute(self,
func: Callable,
state: Dict[str, Any],
step_name: str,
*args, **kwargs) -> Dict[str, Any]:
"""安全执行函数,统一处理异常
Args:
func: 要执行的函数
state: 状态字典
step_name: 步骤名称
*args, **kwargs: 传递给函数的参数
Returns:
执行结果状态
"""
try:
logger.info(f"开始执行: {step_name}")
result = func(state, *args, **kwargs)
logger.info(f"完成执行: {step_name}")
# 确保返回值是有效的状态字典
if result is None:
logger.warning(f"{step_name}返回了None使用原始状态")
return state
elif not isinstance(result, dict):
logger.warning(f"{step_name}返回了无效的状态类型: {type(result)},使用原始状态")
return state
return result
except Exception as e:
error_msg = f"{step_name}失败: {str(e)}"
logger.error(error_msg)
return NodeStateManager.set_error(state, error_msg)
class WorkflowUtilsMixin:
"""工作流工具混入类
提供通用的工作流相关工具方法
"""
@staticmethod
def should_continue_workflow(state: Dict[str, Any]) -> str:
"""检查工作流是否应该继续
Args:
state: 工作流状态字典
Returns:
"continue" 如果应该继续"end" 如果应该停止
"""
if state.get("error") or not state.get("should_continue", True):
return "end"
return "continue"
@staticmethod
def validate_required_fields(state: Dict[str, Any],
required_fields: list) -> bool:
"""验证必需字段是否存在
Args:
state: 状态字典
required_fields: 必需字段列表
Returns:
True 如果所有字段都存在且非空
"""
for field in required_fields:
if not state.get(field):
return False
return True
@staticmethod
def log_step_info(step_name: str, message: str) -> None:
"""记录步骤信息
Args:
step_name: 步骤名称
message: 信息内容
"""
logger.info(f"[{step_name}] {message}")
class TocNodeBase(ErrorHandlerMixin, WorkflowUtilsMixin, ABC):
"""TOC节点基础类
集成所有混入类为TOC节点提供统一的基础功能
"""
def _update_state(self, state: Dict[str, Any], **updates) -> Dict[str, Any]:
"""便捷的状态更新方法
Args:
state: 当前状态
**updates: 要更新的字段
Returns:
更新后的状态
"""
return NodeStateManager.complete_step(state, **updates)
def _set_error(self, state: Dict[str, Any], error_msg: str) -> Dict[str, Any]:
"""便捷的错误设置方法"""
return NodeStateManager.set_error(state, error_msg)
def _add_warning(self, state: Dict[str, Any], warning_msg: str) -> Dict[str, Any]:
"""便捷的警告添加方法"""
return NodeStateManager.add_warning(state, warning_msg)
def _update_progress(self, state: Dict[str, Any], step_name: str, progress: float) -> Dict[str, Any]:
"""便捷的进度更新方法"""
return NodeStateManager.update_progress(state, step_name, progress)

View File

@ -9,11 +9,12 @@ from typing import Dict, List, Any
from ..base import BaseNode, NodeContext from ..base import BaseNode, NodeContext
from ...tools.parser import DocumentChapter from ...tools.parser import DocumentChapter
from .factories import ChapterFactory from .factories import ChapterFactory
from .base_mixins import TocNodeBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class FinalizeChaptersNode(BaseNode): class FinalizeChaptersNode(BaseNode, TocNodeBase):
"""最终确定章节结构的节点""" """最终确定章节结构的节点"""
@property @property
@ -26,19 +27,24 @@ class FinalizeChaptersNode(BaseNode):
def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]: def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]:
"""执行章节最终确定""" """执行章节最终确定"""
preliminary_chapters = state.get("preliminary_chapters", []) return self.safe_execute(self._do_finalize_chapters, state, "最终确定章节结构")
structure_review = state.get("structure_review", {})
if not preliminary_chapters: def _do_finalize_chapters(self, state: Dict[str, Any]) -> Dict[str, Any]:
"""执行实际的章节最终确定逻辑"""
# 验证必需字段
if not self.validate_required_fields(state, ["preliminary_chapters"]):
raise ValueError("缺少初步章节数据") raise ValueError("缺少初步章节数据")
preliminary_chapters = state["preliminary_chapters"]
structure_review = state.get("structure_review", {})
# 应用审查建议并最终确定 # 应用审查建议并最终确定
final_chapters = self._finalize_with_review(preliminary_chapters, structure_review) final_chapters = self._finalize_with_review(preliminary_chapters, structure_review)
# 确保标准章节存在 # 确保标准章节存在
final_chapters = self._ensure_standard_chapters(final_chapters) final_chapters = self._ensure_standard_chapters(final_chapters)
logger.info(f"最终生成{len(final_chapters)}个章节") self.log_step_info("finalize_chapters", f"最终生成{len(final_chapters)}个章节")
return self._update_state(state, return self._update_state(state,
final_chapters=final_chapters, final_chapters=final_chapters,

View File

@ -10,11 +10,12 @@ from ..base import BaseNode, NodeContext
from ...tools.parser import ScoringCriteria, DocumentChapter from ...tools.parser import ScoringCriteria, DocumentChapter
from .category_manager import CategoryManager from .category_manager import CategoryManager
from .factories import ChapterFactory from .factories import ChapterFactory
from .base_mixins import TocNodeBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class GenerateFirstLevelNode(BaseNode): class GenerateFirstLevelNode(BaseNode, TocNodeBase):
"""生成一级章节的节点""" """生成一级章节的节点"""
@property @property
@ -27,16 +28,22 @@ class GenerateFirstLevelNode(BaseNode):
def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]: def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]:
"""执行一级章节生成""" """执行一级章节生成"""
category_groups = state.get("category_groups", {}) return self.safe_execute(self._do_generate_first_level, state, "生成一级章节")
technical_criteria = state.get("technical_criteria", [])
if not category_groups: def _do_generate_first_level(self, state: Dict[str, Any]) -> Dict[str, Any]:
raise ValueError("缺少类别分组数据") """执行实际的一级章节生成逻辑"""
# 验证必需字段
required_fields = ["category_groups", "technical_criteria"]
if not self.validate_required_fields(state, required_fields):
raise ValueError("缺少类别分组数据或技术评分项")
category_groups = state["category_groups"]
technical_criteria = state["technical_criteria"]
# 生成一级章节 # 生成一级章节
chapters = self._generate_first_level_chapters(category_groups, technical_criteria) chapters = self._generate_first_level_chapters(category_groups, technical_criteria)
logger.info(f"生成{len(chapters)}个一级章节") self.log_step_info("generate_first_level", f"生成{len(chapters)}个一级章节")
return self._update_state(state, preliminary_chapters=chapters) return self._update_state(state, preliminary_chapters=chapters)
@ -72,6 +79,6 @@ class GenerateFirstLevelNode(BaseNode):
chapters.append(chapter) chapters.append(chapter)
chapter_index += 1 chapter_index += 1
logger.debug(f"创建一级章节: {chapter.title}") self.log_step_info("create_chapter", f"创建一级章节: {chapter.title}")
return chapters return chapters

View File

@ -11,11 +11,12 @@ from ...tools.parser import ScoringCriteria, DocumentChapter
from .category_manager import CategoryManager from .category_manager import CategoryManager
from .factories import ChapterFactory from .factories import ChapterFactory
from .llm_helper import LLMHelper from .llm_helper import LLMHelper
from .base_mixins import TocNodeBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class GenerateSubChaptersNode(BaseNode): class GenerateSubChaptersNode(BaseNode, TocNodeBase):
"""生成二三级子标题的节点""" """生成二三级子标题的节点"""
@property @property
@ -28,11 +29,17 @@ class GenerateSubChaptersNode(BaseNode):
def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]: def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]:
"""执行子标题生成""" """执行子标题生成"""
preliminary_chapters = state.get("preliminary_chapters", []) return self.safe_execute(self._do_generate_sub_chapters, state, "生成二三级子标题")
technical_criteria = state.get("technical_criteria", [])
if not preliminary_chapters: def _do_generate_sub_chapters(self, state: Dict[str, Any]) -> Dict[str, Any]:
raise ValueError("缺少初步章节") """执行实际的子标题生成逻辑"""
# 验证必需字段
required_fields = ["preliminary_chapters", "technical_criteria"]
if not self.validate_required_fields(state, required_fields):
raise ValueError("缺少初步章节或技术评分项")
preliminary_chapters = state["preliminary_chapters"]
technical_criteria = state["technical_criteria"]
# 为每个章节生成子标题 # 为每个章节生成子标题
enhanced_chapters = [] enhanced_chapters = []
@ -40,7 +47,7 @@ class GenerateSubChaptersNode(BaseNode):
enhanced_chapter = self._enhance_chapter_with_subs(chapter, technical_criteria) enhanced_chapter = self._enhance_chapter_with_subs(chapter, technical_criteria)
enhanced_chapters.append(enhanced_chapter) enhanced_chapters.append(enhanced_chapter)
logger.info(f"完成{len(enhanced_chapters)}个章节的子标题生成") self.log_step_info("generate_sub_chapters", f"完成{len(enhanced_chapters)}个章节的子标题生成")
return self._update_state(state, preliminary_chapters=enhanced_chapters) return self._update_state(state, preliminary_chapters=enhanced_chapters)
@ -60,7 +67,8 @@ class GenerateSubChaptersNode(BaseNode):
corresponding_criteria = CategoryManager.find_corresponding_criteria(chapter, technical_criteria) corresponding_criteria = CategoryManager.find_corresponding_criteria(chapter, technical_criteria)
if not corresponding_criteria: if not corresponding_criteria:
logger.warning(f"章节 {chapter.title} 没有找到对应的评分项") warning_msg = f"章节 {chapter.title} 没有找到对应的评分项"
self.log_step_info("enhance_chapter", warning_msg)
return chapter return chapter
# 使用AI生成子标题 # 使用AI生成子标题
@ -68,9 +76,10 @@ class GenerateSubChaptersNode(BaseNode):
if sub_chapters_data: if sub_chapters_data:
chapter.children = ChapterFactory.create_chapters_from_ai_response(chapter, sub_chapters_data) chapter.children = ChapterFactory.create_chapters_from_ai_response(chapter, sub_chapters_data)
logger.info(f"章节 {chapter.title} 生成了 {len(chapter.children)} 个子标题") self.log_step_info("enhance_chapter", f"章节 {chapter.title} 生成了 {len(chapter.children)} 个子标题")
else: else:
logger.warning(f"章节 {chapter.title} AI生成子标题失败") error_msg = f"AI生成子标题失败: {chapter.title}"
raise RuntimeError(f"AI生成子标题失败: {chapter.title}") self.log_step_info("enhance_chapter", f"章节 {chapter.title} AI生成子标题失败")
raise RuntimeError(error_msg)
return chapter return chapter

View File

@ -9,11 +9,12 @@ from typing import Dict, List, Any
from ..base import BaseNode, NodeContext from ..base import BaseNode, NodeContext
from ...tools.parser import ScoringCriteria from ...tools.parser import ScoringCriteria
from .category_manager import CategoryManager from .category_manager import CategoryManager
from .base_mixins import TocNodeBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class GroupCriteriaNode(BaseNode): class GroupCriteriaNode(BaseNode, TocNodeBase):
"""按类别对评分项分组的节点""" """按类别对评分项分组的节点"""
@property @property
@ -26,15 +27,20 @@ class GroupCriteriaNode(BaseNode):
def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]: def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]:
"""执行分组逻辑""" """执行分组逻辑"""
technical_criteria = state.get("technical_criteria", []) return self.safe_execute(self._do_group_criteria, state, "分组评分项")
if not technical_criteria: def _do_group_criteria(self, state: Dict[str, Any]) -> Dict[str, Any]:
"""执行实际的分组逻辑"""
# 验证必需字段
if not self.validate_required_fields(state, ["technical_criteria"]):
raise ValueError("缺少技术评分项") raise ValueError("缺少技术评分项")
technical_criteria = state["technical_criteria"]
# 执行分组 # 执行分组
category_groups = CategoryManager.group_criteria_by_category(technical_criteria) category_groups = CategoryManager.group_criteria_by_category(technical_criteria)
logger.info(f"分组完成: {len(category_groups)}个类别") self.log_step_info("group_criteria", f"分组完成: {len(category_groups)}个类别")
# 更新状态 # 更新状态
return self._update_state(state, category_groups=category_groups) return self._update_state(state, category_groups=category_groups)

View File

@ -9,11 +9,12 @@ from typing import Dict, List, Any
from ..base import BaseNode, NodeContext from ..base import BaseNode, NodeContext
from ...tools.parser import ScoringCriteria, DocumentChapter from ...tools.parser import ScoringCriteria, DocumentChapter
from .llm_helper import LLMHelper from .llm_helper import LLMHelper
from .base_mixins import TocNodeBase
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class ReviewStructureNode(BaseNode): class ReviewStructureNode(BaseNode, TocNodeBase):
"""AI审查目录结构的节点""" """AI审查目录结构的节点"""
@property @property
@ -26,21 +27,28 @@ class ReviewStructureNode(BaseNode):
def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]: def execute(self, state: Dict[str, Any], context: NodeContext) -> Dict[str, Any]:
"""执行AI审查""" """执行AI审查"""
technical_criteria = state.get("technical_criteria", []) return self.safe_execute(self._do_review_structure, state, "AI审查目录结构")
preliminary_chapters = state.get("preliminary_chapters", [])
if not preliminary_chapters: def _do_review_structure(self, state: Dict[str, Any]) -> Dict[str, Any]:
raise ValueError("缺少章节数据进行审查") """执行实际的AI审查逻辑"""
# 验证必需字段
required_fields = ["technical_criteria", "preliminary_chapters"]
if not self.validate_required_fields(state, required_fields):
raise ValueError("缺少技术评分项或章节数据进行审查")
technical_criteria = state["technical_criteria"]
preliminary_chapters = state["preliminary_chapters"]
# 执行AI审查 # 执行AI审查
review_result = LLMHelper.review_structure_ai(technical_criteria, preliminary_chapters) review_result = LLMHelper.review_structure_ai(technical_criteria, preliminary_chapters)
# 根据审查结果添加警告 # 根据审查结果添加警告
warnings = state.setdefault("warnings", [])
if review_result.get("suggestions"): if review_result.get("suggestions"):
suggestion_count = len(review_result["suggestions"]) suggestion_count = len(review_result["suggestions"])
warnings.append(f"AI审查: {suggestion_count}条优化建议") warning_msg = f"AI审查: {suggestion_count}条优化建议"
state = self._add_warning(state, warning_msg)
logger.info(f"AI审查完成优化评分: {review_result.get('optimization_score', 'N/A')}") optimization_score = review_result.get('optimization_score', 'N/A')
self.log_step_info("review_structure", f"AI审查完成优化评分: {optimization_score}")
return self._update_state(state, structure_review=review_result, warnings=warnings) return self._update_state(state, structure_review=review_result)

View File

@ -1,13 +1,28 @@
"""工作流通用工具函数 """工作流通用工具函数 [已弃用]
警告此模块已弃用请使用 base_mixins.WorkflowUtilsMixin 替代
提供各种工作流中常用的条件判断状态检查等通用功能 提供各种工作流中常用的条件判断状态检查等通用功能
""" """
import warnings
from typing import Dict, Any from typing import Dict, Any
# 导入新的实现
from .base_mixins import WorkflowUtilsMixin
# 发出弃用警告
warnings.warn(
"workflow_utils模块已弃用请使用base_mixins.WorkflowUtilsMixin替代",
DeprecationWarning,
stacklevel=2
)
def should_continue_workflow(state: Dict[str, Any]) -> str: def should_continue_workflow(state: Dict[str, Any]) -> str:
"""通用的工作流继续条件判断 """通用的工作流继续条件判断 [已弃用]
警告此函数已弃用请使用 WorkflowUtilsMixin.should_continue_workflow
检查工作流是否应该继续执行基于错误状态和继续标志 检查工作流是否应该继续执行基于错误状态和继续标志
@ -17,13 +32,18 @@ def should_continue_workflow(state: Dict[str, Any]) -> str:
Returns: Returns:
"continue" 如果应该继续"end" 如果应该停止 "continue" 如果应该继续"end" 如果应该停止
""" """
if state.get("error") or not state.get("should_continue", True): warnings.warn(
return "end" "should_continue_workflow已弃用请使用WorkflowUtilsMixin.should_continue_workflow",
return "continue" DeprecationWarning,
stacklevel=2
)
return WorkflowUtilsMixin.should_continue_workflow(state)
def has_error(state: Dict[str, Any]) -> bool: def has_error(state: Dict[str, Any]) -> bool:
"""检查状态中是否有错误 """检查状态中是否有错误 [已弃用]
警告此函数已弃用建议直接使用 bool(state.get("error"))
Args: Args:
state: 工作流状态字典 state: 工作流状态字典
@ -31,11 +51,18 @@ def has_error(state: Dict[str, Any]) -> bool:
Returns: Returns:
True 如果有错误False 否则 True 如果有错误False 否则
""" """
warnings.warn(
"has_error已弃用建议直接使用bool(state.get('error'))",
DeprecationWarning,
stacklevel=2
)
return bool(state.get("error")) return bool(state.get("error"))
def should_stop(state: Dict[str, Any]) -> bool: def should_stop(state: Dict[str, Any]) -> bool:
"""检查是否应该停止工作流 """检查是否应该停止工作流 [已弃用]
警告此函数已弃用建议使用 WorkflowUtilsMixin 的方法
Args: Args:
state: 工作流状态字典 state: 工作流状态字典
@ -43,4 +70,9 @@ def should_stop(state: Dict[str, Any]) -> bool:
Returns: Returns:
True 如果应该停止False 否则 True 如果应该停止False 否则
""" """
warnings.warn(
"should_stop已弃用建议使用WorkflowUtilsMixin的方法",
DeprecationWarning,
stacklevel=2
)
return has_error(state) or not state.get("should_continue", True) return has_error(state) or not state.get("should_continue", True)