框架: merge_card 巨型分号粘连拆分(唐灵窗51型病,历史弧线连成单条)

This commit is contained in:
zizi 2026-07-15 21:58:59 +08:00
parent 0892bcad7c
commit bbf3736cd5

View File

@ -340,19 +340,24 @@ def merge_card(conn, draft_id, win_no, changes, alias_new, valid_keys=None):
old = fields.get(k) if isinstance(fields.get(k), list) else ([fields[k]] if fields.get(k) else [])
seen = {_strip_prefix(x) for x in old} # 同文去重(抽检#1 重复病)
for it in items:
core = _strip_prefix(it) # 剥模型自带前缀(抽检#1 堆叠病)
if core and _is_garbage(core):
# 结构垃圾条目拒收留审计窗75 事故根治:变更包字符串化混进字段值)
conn.execute(
"""INSERT INTO example_upgrade_audit
(draft_id, window_no, field_name, old_value, new_value, tenant_id)
VALUES (%s,%s,%s,NULL,%s,%s)""",
(draft_id, win_no, ("垃圾拦截:" + str(k))[:100],
str(core)[:2000], TENANT))
continue
if core and core not in seen:
old.append(f"[窗{win_no}] {core}")
seen.add(core)
# 巨型粘连拆分唐灵窗51 实测:模型把整个历史弧线连成一条"…;[窗2]…;[窗3]…"
# 输出成单条目)——按"[窗N]"边界拆段,带原窗号的段保留原窗号,其余记本窗
for seg in re.split(r"\s*(?=\[[窗本])", str(it)):
m0 = re.match(r"^\[窗(\d+)\]\s*(.*)", seg.strip(), flags=re.S)
seg_win, body = (int(m0.group(1)), m0.group(2)) if m0 else (win_no, seg)
core = _strip_prefix(body) # 剥模型自带前缀(抽检#1 堆叠病)
if core and _is_garbage(core):
# 结构垃圾条目拒收留审计窗75 事故根治:变更包字符串化混进字段值)
conn.execute(
"""INSERT INTO example_upgrade_audit
(draft_id, window_no, field_name, old_value, new_value, tenant_id)
VALUES (%s,%s,%s,NULL,%s,%s)""",
(draft_id, win_no, ("垃圾拦截:" + str(k))[:100],
str(core)[:2000], TENANT))
continue
if core and core not in seen:
old.append(f"[窗{seg_win}] {core}")
seen.add(core)
# 窗序归位(抽检 M2补跑/重试窗条目尾插致时间线倒流)——稳定排序,同窗保持原序
fields[k] = sorted(old, key=_entry_win)
elif isinstance(v, str) and _is_garbage(v):