Skip to content

12 个视觉参考图库与浏览器无限画布 AI 创作台(5,700+ 素材、中英提示词、多图对比、ComfyUI & MCP)· Visual reference library & infinite-canvas AI studio in the browser

test: v13 自定义中转断言改为新契约(代理关时直连,拦截直连域名)

atuizz1697d63874a7
diff --git a/tests/v13.js b/tests/v13.js
index 5e41d4b..bc1b668 100644
--- a/tests/v13.js
+++ b/tests/v13.js
@@ -12,7 +12,7 @@ async function setup(prov,vp,dark){const c=await b.newContext({viewport:vp||{wid
if(mode=='slow')await new Promise(r=>setTimeout(r,1500));
const body=/generateContent/.test(u+(req.headers()['x-target-url']||''))?{candidates:[{content:{parts:[{text:'ok'},{inlineData:{mimeType:'image/png',data:img}}]}}]}:{data:[{b64_json:img}]};
return route.fulfill({status:200,headers:H,body:JSON.stringify(body)})};
- await p.route(/api\.openai\.com|generativelanguage\.googleapis\.com|ark\.cn-beijing\.volces\.com|\/api\/proxy/,handler);
+ await p.route(/api\.openai\.com|generativelanguage\.googleapis\.com|ark\.cn-beijing\.volces\.com|relay\.example\.com|\/api\/proxy/,handler);
await p.addInitScript(([prov,dark])=>{if(!sessionStorage.x){sessionStorage.x=1;localStorage.setItem('wbCfg',JSON.stringify({prov,key:'sk-test-123',base:prov=='custom'?'https://relay.example.com':'',model:'',field:'image[]',proto:'json',proxy:false}));localStorage.setItem('introX','1');if(dark)localStorage.setItem('theme','dark')}window.__TMO=3000},[prov,dark]);
await p.goto(U+'/#studio');await p.waitForFunction(()=>window.WB&&window.APP,null,{timeout:15000});
await p.setInputFiles('#wbFile',FX+'person.png');
@@ -22,7 +22,7 @@ const go=async(p)=>{await p.click('#wbGo');await p.waitForFunction(()=>!document
const st=p=>p.evaluate(()=>({res:WB&&document.querySelector('#wbAfter').src.slice(0,5),err:document.querySelector('#wbErr').hidden?'':document.querySelector('#wbErr').innerText.replace(/\s+/g,' '),hist:document.querySelectorAll('#wbHist [data-t]').length,toast:(document.querySelector('#toast')||{}).innerText||''}));
for(const prov of ['openai','gemini','seedream','custom']){hits=[];mode='ok';const {c,p}=await setup(prov);await go(p);let s=await st(p);R.push([prov+' success',s.res=='blob:'&&!s.err&&s.hist>=1,JSON.stringify(s)+' '+hits[0]]);
if(prov=='gemini'||prov=='seedream'){for(const m of prov=='gemini'?['safe-gem','safe-gem2']:['safe-sd']){hits=[];mode=m;await go(p);const t=await p.$eval('#wbErr',e=>e.innerText);R.push([m,/安全审核/.test(t)&&hits.length==1&&!/检查 API 设置/.test(t),t.slice(0,80)+' hits '+hits.length])}mode='ok'}
- if(prov=='custom')R.push(['custom via proxy',hits.every(h=>/\/api\/proxy/.test(h)&&/relay\.example/.test(h)),hits[0]]);
+ if(prov=='custom')R.push(['custom direct when proxy off',hits.length>0&&hits.every(h=>{const u=h.split(' ')[1];return /relay\.example\.com/.test(u)&&!/api\/proxy/.test(u)}),hits[0]]);
if(prov=='openai'){await p.screenshot({path:S+'d-result.png'});
{await p.evaluate(()=>{document.querySelector('details.adv').open=true;const x=document.querySelector('#wbExtra');x.value='性感紧身露背比基尼,sexy tight backless bikini, emphasizing her curves';x.dispatchEvent(new Event('input',{bubbles:true}))});
const on0=await p.$eval('#wbNeutral',e=>e.checked);mode='ok';bodies=[];await go(p);const bOn=bodies.join(' ');