Ver código fonte

v0.0.5-功能优化-目录审查临时代码合并

WangXuMing 1 mês atrás
pai
commit
8a8d6fbeaa

+ 1 - 1
core/construction_review/component/reviewers/prompt/query_extract.yaml

@@ -39,7 +39,7 @@ query_extract:
 
   user_template: |
     ## 任务
-    从文本中提取 **2个** 最关键的实体对象。视信息密度而定,优先关注**高风险工程部位**(如基坑、支架)和**核心受力构件**。
+    从文本中提取 **3个** 最关键的实体对象。视信息密度而定,优先关注**高风险工程部位**(如基坑、支架)和**核心受力构件**。
 
     ## 示例 1 (避免泛化词提取)
     文本: "大型临时设施选用的原材料、构件、扣件和其他重要受力的辅助材料进行质量验收。严禁使用不合格材料。"

+ 24 - 0
core/construction_review/workflows/ai_review_workflow.py

@@ -377,9 +377,30 @@ class AIReviewWorkflow:
             # 初始化issues列表
             all_issues = []
             completed_chunks = 0
+            # 添加目录章节内容
+            catalogue = [{
+                    "chunk_id": "outline_1",
+                    "page": 1,
+                    "content": "full_content",
+                    "section_label": "目录",
+                    "project_plan_type": "catalogue",
+                    "chapter_classification": "catalogue",
+                    "element_tag": {
+                        "chunk_id": "outline_1",
+                        "page": 1,
+                        "serial_number": "1"
+                    },
+                    "chapter": "目录",
+                    "title": "目录",
+                    "original_content": "full_content",
+                    "is_complete_field": False
+                }
+            ]
             chapter_chunks_map, chapter_names = self.core_fun._group_chunks_by_chapter(filtered_chunks)
             # with open("temp/filtered_chunks/chapter_chunks_map.json", "w", encoding="utf-8") as f:
             #      json.dump(chapter_chunks_map, f, ensure_ascii=False, indent=4)
+            chapter_chunks_map["catalogue"] = catalogue
+            review_item_dict_sorted["catalogue"] = ["check_completeness"]
             logger.info(f"内容分组完成,共 {len(chapter_chunks_map)} 个章节")
             await self.core_fun._send_start_review_progress(state,total_chunks, chapter_names)
             # 6️ 按章节处理
@@ -406,6 +427,9 @@ class AIReviewWorkflow:
 
                 logger.info(f"章节 {chapter_code} 处理完成")
             logger.info(f"all_issues_结果调试: {all_issues} 个块")
+
+            # 
+
             # 7️ 汇总结果
             summary = self.inter_tool._aggregate_results(all_issues)
             

+ 26 - 13
core/construction_review/workflows/core_functions/ai_review_core_fun.py

@@ -430,19 +430,32 @@ class AIReviewCoreFun:
             )
             logger.info(f"[outline_check完成] 共发现 {len(outline_result.get('details', {}).get('response', []))} 个缺失项")
 
-            # 将两个结果都放入 basic_compliance
-            return UnitReviewResult(
-                unit_index=chunk_index,
-                unit_content=chunk,
-                basic_compliance={
-                    "check_completeness": completeness_result,
-                    "outline_check": outline_result
-                },
-                technical_compliance={},
-                rag_enhanced={},
-                overall_risk=self._calculate_single_result_risk(completeness_result),
-                is_sse_push=True
-            )
+            # 对比逻辑
+            if chapter_code == "catalogue" and func_name == "catalogue_check":
+                    return UnitReviewResult(
+                        unit_index=chunk_index,
+                        unit_content=chunk,
+                        basic_compliance={
+                            "catalogue_check": catalogue_result
+                        },
+                        technical_compliance={},
+                        rag_enhanced={},
+                        overall_risk=self._calculate_single_result_risk(completeness_result),
+                    )
+            else:
+                # 将两个结果都放入 basic_compliance
+                return UnitReviewResult(
+                    unit_index=chunk_index,
+                    unit_content=chunk,
+                    basic_compliance={
+                        "check_completeness": completeness_result,
+                        "outline_check": outline_result
+                    },
+                    technical_compliance={},
+                    rag_enhanced={},
+                    overall_risk=self._calculate_single_result_risk(completeness_result),
+                    is_sse_push=True
+                )
         elif func_name == "check_non_parameter_compliance" and not is_complete_field:
             # 技术审查方法需要从 RAG 检索结果中获取 references
             raw_result = await self._execute_technical_review(