瀏覽代碼

feat(completeness): 完整性审查结果新增 first_seq/second_seq/third_seq 字段

- 一级缺失: 包含 first_seq
- 二级缺失: 包含 first_seq + second_seq
- 三级缺失: 包含 first_seq + second_seq + third_seq
- 一致性审查: 包含 first_seq + second_seq
- 字段顺序保持相邻,便于前端排序
WangXuMing 5 天之前
父節點
當前提交
3c89efc18a

+ 12 - 2
core/construction_review/component/ai_review_engine.py

@@ -762,10 +762,19 @@ class AIReviewEngine(BaseReviewer):
                     new_location = f"{chapter_name} > {sec_part}"
                     issue_point = issue_point.replace(location, new_location, 1)
                     location = new_location
-                response_items.append({
+                # 按顺序构建响应字段(first_seq -> second_seq -> third_seq 相邻)
+                response_item = {
                     "check_item": "completeness_check",
                     "chapter_code": chapter_code if chapter_code != "all" else "unknown",
-                    "first_seq": current_first_seq,
+                    "first_seq": rec.get('first_seq', current_first_seq),
+                }
+                # 根据缺失级别添加对应的 seq(缺失哪级就到哪级)
+                if 'second_seq' in rec:
+                    response_item["second_seq"] = rec['second_seq']
+                if 'third_seq' in rec:
+                    response_item["third_seq"] = rec['third_seq']
+                # 继续添加其他字段
+                response_item.update({
                     "check_item_code": f"{chapter_code if chapter_code != 'all' else 'unknown'}_completeness_check",
                     "check_result": {
                         "issue_point": issue_point,
@@ -777,6 +786,7 @@ class AIReviewEngine(BaseReviewer):
                     "exist_issue": True,
                     "risk_info": {"risk_level": risk_level_en}
                 })
+                response_items.append(response_item)
             
             # 如果没有缺失项,显示完整度
             if not response_items:

+ 12 - 3
core/construction_review/component/reviewers/completeness_reviewer.py

@@ -1023,10 +1023,17 @@ JSON输出:"""
         # ── 一致性审查:目录有列但正文无内容 ─────────────────────────────
         if outline_result:
             for e in outline_result.get("empty_sections", []):
+                f_code = e.get("first_code", "")
                 f_name = e.get("first_name", "")
+                sec_code = e.get("secondary_code", "")
                 sec_title = e.get("outline_title") or e.get("secondary_name", "")
                 location = f"{f_name} > {sec_title}" if f_name else sec_title
 
+                # 从 secondary_specs 获取 seq
+                sec_item = self.secondary_specs.get((f_code, sec_code))
+                first_seq = sec_item.first_seq if sec_item else 0
+                second_seq = sec_item.second_seq if sec_item else 0
+
                 # issue_point 和 reason 使用简单拼接(一致性审查)
                 issue_point = f"【目录正文不一致】'{location}'目录已列但正文无内容"
                 reason = f"依据《桥梁公司危险性较大工程管理实施细则(2025版)》规定,目录应与正文保持一致。目录页列有'{sec_title}'章节,但正文中未发现对应内容"
@@ -1034,12 +1041,12 @@ JSON输出:"""
                 # 尝试使用LLM生成 suggestion
                 llm_result = await self._generate_recommendation_with_llm(
                     level="一致性",
-                    first_code="",
+                    first_code=f_code,
                     first_name=f_name,
                     second_name=sec_title,
                     outline_title=sec_title,
-                    first_seq=0,
-                    second_seq=0
+                    first_seq=first_seq,
+                    second_seq=second_seq
                 )
 
                 if llm_result and llm_result.get("suggestion"):
@@ -1054,6 +1061,8 @@ JSON输出:"""
                     "location": location,
                     "suggestion": suggestion,
                     "reason": reason,
+                    "first_seq": first_seq,
+                    "second_seq": second_seq,
                 })
 
         if not recommendations: