Files
CompanionGuard-RL/tools/html_to_ppt_probe.js
zhangsiyuan 52ba43f08d feat: Module C v5/v6 training complete, ablations, SOTA baselines, paper updates
- Module C: BC+PPO training v5/v6 done; eval results in experiments/eval_intervention_v{5,6}.json
- Reward: v5 label-aligned constrained reward (code/src/rl/reward.py)
- Ablations: Module B (history_r, response_only, full) + Module C (wo_category_reward)
- SOTA baselines: WildGuard and ShieldGemma2b eval scripts and results
- Paper: update sections 05–08 (Module B/C description, experiments table, discussion)
- Docs: add record.md (change log), update state.md and exp.md; retire change.md
- Tools: add html-to-ppt utilities and run_shieldgemma2b.sh
- Configs: add ablation YAML configs for Module B and C
- Cleanup: remove stale reference/ PNG screenshots

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 14:24:09 +08:00

44 lines
1.5 KiB
JavaScript

const { chromium } = require('playwright');
const input = process.argv[2];
(async () => {
const launchOptions = { headless: true };
if (process.env.BROWSER_EXE) {
launchOptions.executablePath = process.env.BROWSER_EXE;
}
const browser = await chromium.launch(launchOptions);
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 }, deviceScaleFactor: 1 });
await page.goto(input, { waitUntil: 'load', timeout: 30000 });
await page.waitForTimeout(1500);
await page.waitForSelector('section', { state: 'attached', timeout: 10000 });
const info = await page.evaluate(() => {
const sections = Array.from(document.querySelectorAll('section'));
return {
title: document.title,
url: location.href,
bodyText: document.body.innerText.slice(0, 500),
count: sections.length,
viewport: { w: innerWidth, h: innerHeight },
scroll: { w: document.documentElement.scrollWidth, h: document.documentElement.scrollHeight },
sections: sections.map((s, i) => {
const r = s.getBoundingClientRect();
const cs = getComputedStyle(s);
return {
index: i + 1,
label: s.getAttribute('data-label') || '',
rect: { x: r.x, y: r.y, w: r.width, h: r.height },
display: cs.display,
visibility: cs.visibility,
opacity: cs.opacity,
};
}),
};
});
console.log(JSON.stringify(info, null, 2));
await browser.close();
})().catch((err) => {
console.error(err);
process.exit(1);
});