fix(parse-book): check终检接敏感降级链+断点续跑+单窗拦截跳窗——批9实测超神窗20敏感崩全程
This commit is contained in:
parent
1c65466729
commit
74989afb97
@ -183,15 +183,28 @@ def check(work_id, model):
|
||||
with psycopg.connect(DSN) as conn:
|
||||
title = conn.execute("SELECT title FROM muse_content_work WHERE id=%s", (work_id,)).fetchone()[0]
|
||||
wins = conn.execute(
|
||||
"""SELECT id, window_no, from_order, to_order, outline_text FROM example_parse_outline
|
||||
"""SELECT id, window_no, from_order, to_order, outline_text, check_status
|
||||
FROM example_parse_outline
|
||||
WHERE tenant_id=%s AND work_id=%s AND deleted=FALSE ORDER BY window_no""",
|
||||
(TENANT, work_id)).fetchall()
|
||||
chs = load_chapters(conn, work_id)
|
||||
n_issue = 0
|
||||
for oid, wno, a, b, ol in wins:
|
||||
for oid, wno, a, b, ol, st in wins:
|
||||
# 断点续跑:已检窗(checked/revised)不重刷,敏感崩溃后重启只补 pending
|
||||
if st and st != "pending":
|
||||
continue
|
||||
outlines = "\n".join(f"第{no}章《{ct}》:{o}" for no, ct, _, o in chs if a <= no <= b and o)
|
||||
content, _ = chat(CHECK_PROMPT.format(title=title, a=a, b=b, outline=ol, outlines=outlines),
|
||||
model=model)
|
||||
try:
|
||||
content, _ = chat_degrade(CHECK_PROMPT.format(
|
||||
title=title, a=a, b=b, outline=ol, outlines=outlines), model)
|
||||
except SensitiveError as e:
|
||||
# 全降级链被拦:标记跳窗继续,不让单窗炸掉整书终检(批9实测超神窗20崩全程)
|
||||
conn.execute(
|
||||
"UPDATE example_parse_outline SET check_status='blocked', check_note=%s, updater=%s WHERE id=%s",
|
||||
(f"敏感拦截: {str(e)[:180]}", ACTOR, oid))
|
||||
conn.commit()
|
||||
click.echo(f"win-{wno:02d} 对账✗ 全链敏感拦截,跳过")
|
||||
continue
|
||||
data = extract_json(content)
|
||||
issues = data.get("issues") or []
|
||||
n_issue += len(issues)
|
||||
@ -205,10 +218,13 @@ def check(work_id, model):
|
||||
# 全书连贯性纵览(一次调用,只给大纲串)
|
||||
if len(wins) > 1:
|
||||
allo = "\n\n".join(f"【阶段{w[1]}(第{w[2]}–{w[3]}章)】\n{w[4]}" for w in wins)
|
||||
content, _ = chat(COHERENCE_PROMPT.format(title=title, n=len(wins), outlines=allo), model=model)
|
||||
try:
|
||||
content, _ = chat_degrade(COHERENCE_PROMPT.format(title=title, n=len(wins), outlines=allo), model)
|
||||
data = extract_json(content)
|
||||
for i in (data.get("issues") or []):
|
||||
click.echo(f" [跨段] {i}")
|
||||
except SensitiveError:
|
||||
click.echo(" [跨段] 全链敏感拦截,纵览跳过")
|
||||
click.echo(f"终检完成:{len(wins)} 窗,细纲对账发现 {n_issue} 处")
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user