Files
kefu/deploy/review-assistant-20260917/preview-reminder.cjs
T
2026-09-21 10:34:06 +08:00

21 lines
2.4 KiB
JavaScript

const { chromium } = require('C:/kefu/admin-web/node_modules/playwright');
const path = require('path');
(async()=>{
const browser = await chromium.launch({headless:true, executablePath:'C:/Program Files/Google/Chrome/Application/chrome.exe',args:['--disable-gpu','--allow-file-access-from-files']});
const page=await browser.newPage({viewport:{width:1440,height:1100},deviceScaleFactor:1});
await page.route(/^https?:/, route=>route.abort());
const errors=[];page.on('pageerror',e=>errors.push(String(e)));
for(const [tag,root] of [['production','C:/wechat_rpa'],['source','C:/kefu/wechat_rpa']]){
await page.goto('file:///'+root+'/assets/ui/zhenyang-ai-console.html');
await page.evaluate(()=>{
window.applyState({view:'automation',ready:true,demo:false,automation:{transport:'visual',wecom:'已识别',account:'合成账号',reviewAssistant:{supported:true,ready:true,enabled:false,busy:false,accountId:'168800000000001',accountName:'合成托管账号',recipient:{id:'M:10001',name:'合成医疗助理',label:'私人微信 · 联系编号 10001'},notification:{message:'已发送提醒,等待人工直接回复客户'},preview:'【客户待审核提醒】\n托管企微账号:合成托管账号\n客户:示例客户(实际提醒包含会话标识)\n客户咨询:这里显示本轮待处理的客户消息\n待发送回复:这里显示 AI 生成、尚未发送的回复\n审核原因:这里显示命中的审核原因\n请用同一企业微信账号直接回复该客户,结束本次审核。后续自动回复仍逐条风控。\n——以上仅为内容示例,不会发送消息。'}}});
render('automation');document.documentElement.classList.add('embedded');window.fit();
});
await page.screenshot({path:'C:/kefu/deploy/review-assistant-20260917/assistant-settings-'+tag+'-chrome.png'});
await page.locator('summary').filter({hasText:'提醒内容示例'}).click();
await page.screenshot({path:'C:/kefu/deploy/review-assistant-20260917/assistant-preview-'+tag+'-chrome.png'});
console.log(tag,JSON.stringify(await page.evaluate(()=>({viewport:[innerWidth,innerHeight],main:[document.querySelector('#main').clientHeight,document.querySelector('#main').scrollHeight],panel:document.querySelector('[data-action=review-assistant-toggle]').getBoundingClientRect().toJSON(),errors:[] }))));
}
console.log('scriptErrors',JSON.stringify(errors));await browser.close();
})().catch(e=>{console.error(e);process.exit(1)});