fix(question_gen): resolve pipeline integration issues from final review

1. Apply postprocess shuffle result (pp.options, pp.answer) to final
   GeneratedQuestion output instead of using original candidate values.

2. Record dedup rejection in store via new mark_item_rejected() method,
   preventing items from staying as 'accepted' after dedup rejects them.

3. Add .flatten() to embed_fn outputs in _is_duplicate and embed_pool
   append to handle 2D (1,D) arrays from embedding implementations.

4. Validate exactly 4 options in _validate_parsed_fields (was >= 2),
   matching the A-D answer constraint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 00:14:12 -04:00
parent eecb86e27a
commit 4fb7a61f8b
4 changed files with 86 additions and 14 deletions
+19
View File
@@ -330,6 +330,25 @@ class QuestionGenStore:
if cursor.rowcount == 0:
raise ValueError(f"item_id 不存在: {item_id}")
def mark_item_rejected(self, item_id: str, reason: str) -> None:
"""将已记录的 item 标记为 rejected(用于门控外的拒绝场景,如去重)。
Parameters
----------
item_id : str
题目唯一 ID。
reason : str
拒绝原因描述。
"""
cursor = self._conn.execute(
"UPDATE question_gen_items SET final_status='rejected', gate_reject_reason=? "
"WHERE item_id=?",
(reason, item_id),
)
self._conn.commit()
if cursor.rowcount == 0:
raise ValueError(f"item_id 不存在: {item_id}")
def update_difficulty(self, item_id: str, difficulty_steps: int) -> None:
"""更新重量抽检产出的 Agent 步数。