|
@@ -313,10 +313,31 @@ class AIReviewWorkflow:
|
|
|
# 根据标准配置对review_item_config进行排序
|
|
# 根据标准配置对review_item_config进行排序
|
|
|
review_item_dict_sorted = self.core_fun._check_item_mapping_order(review_item_config)
|
|
review_item_dict_sorted = self.core_fun._check_item_mapping_order(review_item_config)
|
|
|
logger.info(f"审查项配置解析完成: {review_item_dict_sorted}")
|
|
logger.info(f"审查项配置解析完成: {review_item_dict_sorted}")
|
|
|
-
|
|
|
|
|
|
|
+ outline_content_list = []
|
|
|
# 3️ 获取结构化内容
|
|
# 3️ 获取结构化内容
|
|
|
original_chunks = state.get("structured_content", {}).get("chunks", [])
|
|
original_chunks = state.get("structured_content", {}).get("chunks", [])
|
|
|
original_outline = state.get("structured_content", {}).get("outline", [])["chapters"]
|
|
original_outline = state.get("structured_content", {}).get("outline", [])["chapters"]
|
|
|
|
|
+
|
|
|
|
|
+ def extract_original_recursive(content):
|
|
|
|
|
+ """递归提取 original 字段,包括主目录和所有子目录"""
|
|
|
|
|
+ result = []
|
|
|
|
|
+ if isinstance(content, dict):
|
|
|
|
|
+ # 提取当前层级的 original
|
|
|
|
|
+ if "original" in content:
|
|
|
|
|
+ result.append(content["original"])
|
|
|
|
|
+ # 递归提取 subsections
|
|
|
|
|
+ if "subsections" in content and isinstance(content["subsections"], list):
|
|
|
|
|
+ for subsection in content["subsections"]:
|
|
|
|
|
+ result.extend(extract_original_recursive(subsection))
|
|
|
|
|
+ return result
|
|
|
|
|
+
|
|
|
|
|
+ for content in original_outline:
|
|
|
|
|
+ # 递归提取主目录和子目录的 original 字段
|
|
|
|
|
+ originals = extract_original_recursive(content)
|
|
|
|
|
+ outline_content_list.extend(originals)
|
|
|
|
|
+
|
|
|
|
|
+ # 4. 最终拼接成字符串(列表join效率远高于str+=)
|
|
|
|
|
+ outline_content_str = "".join(outline_content_list)
|
|
|
# with open(r"temp/document_temp/original_outline.json", "w", encoding="utf-8") as f:
|
|
# with open(r"temp/document_temp/original_outline.json", "w", encoding="utf-8") as f:
|
|
|
# json.dump(original_outline, f, ensure_ascii=False, indent=2)
|
|
# json.dump(original_outline, f, ensure_ascii=False, indent=2)
|
|
|
logger.info(f"开始目录审查")
|
|
logger.info(f"开始目录审查")
|
|
@@ -381,7 +402,7 @@ class AIReviewWorkflow:
|
|
|
catalogue = [{
|
|
catalogue = [{
|
|
|
"chunk_id": "outline_1",
|
|
"chunk_id": "outline_1",
|
|
|
"page": 1,
|
|
"page": 1,
|
|
|
- "content": "full_content",
|
|
|
|
|
|
|
+ "content": outline_content_str,
|
|
|
"section_label": "目录",
|
|
"section_label": "目录",
|
|
|
"project_plan_type": "catalogue",
|
|
"project_plan_type": "catalogue",
|
|
|
"chapter_classification": "catalogue",
|
|
"chapter_classification": "catalogue",
|
|
@@ -392,7 +413,7 @@ class AIReviewWorkflow:
|
|
|
},
|
|
},
|
|
|
"chapter": "目录",
|
|
"chapter": "目录",
|
|
|
"title": "目录",
|
|
"title": "目录",
|
|
|
- "original_content": "full_content",
|
|
|
|
|
|
|
+ "original_content": outline_content_str,
|
|
|
"is_complete_field": True
|
|
"is_complete_field": True
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|