更新审核提示流程与工作台版本

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
LongtailandCopilot committed 2026-10-31 18:13:25 +08:00
1 parent d2f58ba687
commit 24a73b19c0
12 files changed
+296 -268

No files matched your search

+31
View File
@@ -305,6 +305,10 @@ class Store:
return {'ok': True, 'duplicate': True}
if self.run['active'] != job['id'] or job['state'] not in SUBMITTED:
raise ValueError('只有已观察到人工提交的任务才能登记结果')
if isinstance(data.get('evidence'), dict) and data['evidence'].get('adapter') == 'moderation_prompt':
if not count_batch:
raise ValueError('审核提示只用于当前人工提交任务,不能补核历史结果')
return self._accept_prompt(db, job, data)
url = urlsplit(str(data.get('post_url', '')))
match = re.fullmatch(r'/thread/(\d+)\.html', url.path)
query = parse_qs(url.query)
@@ -347,6 +351,33 @@ class Store:
self._persist(db)
return {'ok': True, 'run': dict(self.run)}
def _accept_prompt(self, db, job, data):
"""Temporary acceptance rule: the forum's explicit moderation prompt only."""
evidence = data['evidence']
message = '新主题需要审核,您的帖子通过审核后才能显示'
text = ' '.join(str(evidence.get('observed_text', '')).split())
url = urlsplit(str(evidence.get('observed_url', '')))
if (data.get('state') != 'accepted_pending_moderation'
or evidence.get('message') != message or message not in text):
raise ValueError('缺少网站新主题审核提示')
if url.scheme != 'https' or url.netloc not in ('www.dww11.com', 'dww11.com'):
raise ValueError('审核提示必须来自论坛网站')
if not job.get('attempt') or data.get('attempt') != job['attempt']:
raise ValueError('审核提示与当前提交批次不一致')
# 未核对详情页,不虚构主题 ID、首帖 ID 或帖子地址。
job.update(state='accepted_pending_moderation', error='', result=evidence,
integrity_issues=[], historical_reconciliation=False,
acceptance_basis='moderation_prompt')
keys = ['article:' + job['article_key'], 'md:' + job['markdown_sha256']] + ['source:' + str(k) for k in job['source_keys']]
for key in keys:
db.execute('INSERT OR REPLACE INTO ledger VALUES(?,?)', (key, json.dumps(job, ensure_ascii=False)))
self.run['batch']['count'] += 1
self.run.update(active=None, return_home=True,
not_before=time.time() + self.run['config']['interval'])
self._save(db, job)
self._persist(db)
return {'ok': True, 'run': dict(self.run)}
def resolve(self, data):
"""Explicit local UI resolution, never an automatic retry of an unknown submission."""
with self.lock, self.db() as db: