|
|
@@ -300,6 +300,7 @@ class AIReviewWorkflow:
|
|
|
'parameter_compliance_check': 'check_parameter_compliance'
|
|
|
}
|
|
|
|
|
|
+
|
|
|
review_item_config_raw = self.task_info.get_review_item_config_list()
|
|
|
review_item_config = self.core_fun._replace_review_suffix(review_item_config_raw, review_func_mapping)
|
|
|
|
|
|
@@ -307,19 +308,37 @@ class AIReviewWorkflow:
|
|
|
for item in review_item_config:
|
|
|
key, value = item.split("_", 1)
|
|
|
review_item_dict.setdefault(key, []).append(value)
|
|
|
-
|
|
|
- logger.info(f"审查项配置解析完成: {review_item_dict}")
|
|
|
+
|
|
|
+ # 依据方案标准章节顺序进行排序
|
|
|
+ sgfa_chapter_index_order = ["catalogue", "basis", "overview", "plan","technology", "safety", "quality", "environment",
|
|
|
+ "management", "acceptance", "other"]
|
|
|
+
|
|
|
+ all_keys = review_item_dict.keys()
|
|
|
+ sorted_keys = sorted(
|
|
|
+ all_keys,
|
|
|
+ key=lambda x :sgfa_chapter_index_order.index(x)
|
|
|
+ )
|
|
|
+ review_item_dict_sorted = {}
|
|
|
+ for key in sorted_keys:
|
|
|
+ review_item_dict_sorted[key] = review_item_dict[key]
|
|
|
+ logger.info(f"审查项配置解析完成: {review_item_dict_sorted}")
|
|
|
|
|
|
# 3️ 获取结构化内容
|
|
|
structured_content = state.get("structured_content", {})
|
|
|
- chunks = structured_content.get("chunks", [])
|
|
|
- total_chapters = len(review_item_dict)
|
|
|
- total_chunks = len(chunks)
|
|
|
|
|
|
- logger.info(f"准备执行动态审查任务,总章节数: {total_chapters}, 总块数: {total_chunks}")
|
|
|
+ # 预处理:根据 review_item_dict_sorted 中的 key 对 structured_content 进行筛选
|
|
|
+ original_chunks = structured_content.get("chunks", [])
|
|
|
+ filtered_chunks = [
|
|
|
+ chunk for chunk in original_chunks
|
|
|
+ if chunk.get("chapter_classification") in review_item_dict_sorted.keys()
|
|
|
+ ]
|
|
|
+
|
|
|
+ # 更新 chunks 和 structured_content
|
|
|
+ chunks = filtered_chunks
|
|
|
+ structured_content["chunks"] = chunks
|
|
|
|
|
|
- # 发送开始审查进度
|
|
|
- await self.core_fun._send_start_review_progress(state, total_chunks, 'check_item_review')
|
|
|
+ total_chapters = len(review_item_dict_sorted)
|
|
|
+ total_chunks = len(chunks)
|
|
|
|
|
|
# 初始化issues列表
|
|
|
all_issues = []
|
|
|
@@ -333,7 +352,9 @@ class AIReviewWorkflow:
|
|
|
)
|
|
|
|
|
|
if has_outline_check and outline_data:
|
|
|
- logger.info(" 开始执行大纲审查")
|
|
|
+ total_chunks = total_chunks + 1 # 包含大纲审查块
|
|
|
+ await self.core_fun._send_start_review_progress(state, total_chunks, 'check_item_review')
|
|
|
+ logger.info(f"准备执行动态审查任务(含大纲审查),总章节数: {total_chapters}, 总块数: {total_chunks}")
|
|
|
try:
|
|
|
outline_result = await self.ai_review_engine.outline_check(
|
|
|
state["callback_task_id"],
|
|
|
@@ -346,6 +367,9 @@ class AIReviewWorkflow:
|
|
|
logger.info(f"大纲审查完成")
|
|
|
except Exception as e:
|
|
|
logger.error(f"大纲审查失败: {str(e)}", exc_info=True)
|
|
|
+ else:
|
|
|
+ await self.core_fun._send_start_review_progress(state, total_chunks, 'check_item_review')
|
|
|
+ logger.info(f"准备执行动态审查任务,总章节数: {total_chapters}, 总块数: {total_chunks}")
|
|
|
|
|
|
# 5️ 按章节分组
|
|
|
chapter_chunks_map = self.core_fun._group_chunks_by_chapter(chunks)
|
|
|
@@ -369,14 +393,14 @@ class AIReviewWorkflow:
|
|
|
# 判断章节类型并分支处理
|
|
|
if chapter_code == "basis":
|
|
|
# === 编制依据章节:拼接所有chunk后一次性审查 ===
|
|
|
- await self.core_fun._process_basis_chapter(
|
|
|
+ all_issues = await self.core_fun._process_basis_chapter(
|
|
|
chapter_code, chapter_content, func_names, state, all_issues, completed_chunks, total_chunks
|
|
|
)
|
|
|
# 更新已完成块数
|
|
|
completed_chunks += len(chapter_content)
|
|
|
else:
|
|
|
# === 普通章节:逐块审查 ===
|
|
|
- chunks_completed = await self.core_fun._process_normal_chapter(
|
|
|
+ chunks_completed, all_issues = await self.core_fun._process_normal_chapter(
|
|
|
chapter_code, chapter_content, func_names, state, all_issues
|
|
|
)
|
|
|
# 更新已完成块数
|