', '${liveRibbonQueue()}${reviewSummary()}
')
s = replace_once(s, 'const pills = ["全部","处理中","等待中","待重试"]', 'const pills = ["全部","待审核","需人工","处理中","等待中","待重试"]')
# Preserve the demo screen, update only the live view's description.
pos = s.index('queueView = function(){')
s = s[:pos] + s[pos:].replace('查看排队、处理中与待重试的自动回复任务', '查看待审核、需人工处理及自动回复任务', 1)
s = replace_once(s, ' answer: state.task.answer,', ''' answer: state.task.answer,
awaitingReview: state.task.awaitingReview,
canApprove: state.task.canApprove,
needsHuman: state.task.needsHuman,
reviewReason: state.task.reviewReason,
isProtocol: state.task.isProtocol,
foreignDraft: state.task.foreignDraft,''')
s = replace_once(s, 'const metricModes = [Number(metrics.failed) > 0, Number(metrics.warnings) > 0];', 'const metricModes = [Number(metrics.failed) > 0, Number(metrics.warnings) > 0, Number(metrics.review) || 0, Number(metrics.human) || 0];')
s = replace_once(s, ' "approve-task": () => callBridge("approveTask", key),', ''' "approve-task": () => {
if (!taskCanApprove(STATE.task) || STATE.task.key !== key) return toast("任务状态已变化,请重新选择待审核任务。");
callBridge("approveTask", key);
},
"open-review-queue": () => {
STATE.queueFilter = key;
if (STATE.view !== "queue") {
if (typeof flushEdits === "function") flushEdits();
window.__pendingNavigation = "queue";
window.__navigationSerial = (window.__navigationSerial || 0) + 1;
render("queue");
callBridge("navigate", "queue");
}
callBridge("setQueueFilter", key);
},''')
return s
results=[]
for root in ROOTS:
backup=root/'backups/review-visibility-20260916/frontend'
for relative in ['assets/ui/console-app.js','assets/ui/zhenyang-ai-console.html']:
src=root/relative; dest=backup/relative
assert not dest.exists(), f'Backup exists: {dest}'
dest.parent.mkdir(parents=True, exist_ok=True); shutil.copy2(src,dest)
js=root/'assets/ui/console-app.js'
js.write_text(patch_js(js.read_text(encoding='utf-8')),encoding='utf-8',newline='\n')
html=root/'assets/ui/zhenyang-ai-console.html'
text=html.read_text(encoding='utf-8')
text,n=re.subn(r'console-app\.js\?v=[^"\s]+', 'console-app.js?v=review1', text)
assert n==1
text=replace_once(text,'', ' \n')
html.write_text(text,encoding='utf-8',newline='\n')
(root/'assets/ui/console-review.css').write_text(CSS,encoding='utf-8',newline='\n')
results.append({'root':str(root),'files':[{'path':p,'sha256':hashlib.sha256((root/p).read_bytes()).hexdigest()} for p in ['assets/ui/console-app.js','assets/ui/zhenyang-ai-console.html','assets/ui/console-review.css']]})
report=Path('C:/kefu/deploy/review-visibility-20260916/frontend-files.json')
report.write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps(results,ensure_ascii=False))