fix bingAI draw

This commit is contained in:
James Feng Cao 2023-05-10 09:02:04 +08:00
parent f8529dc7de
commit 54c1db0255
2 changed files with 10 additions and 8 deletions

View File

@ -3,6 +3,14 @@
<base href="https://jamesfengcao.codeberg.page/en/searchurl/bingAI/">
<title id="docTitle">Draw</title>
<link rel="stylesheet" href="./css/DrawImg.css">
<script>
function getMagicUrl() {
let v = localStorage.GoGoUrl;
if(v && v.startsWith("http")) return v;
return "https://mybing2.xn--xyza.top/";
}
const magicUrl = getMagicUrl();
</script>
<script type="text/javascript" src="./js/generateImages.js"></script>
</head>
<body>
@ -16,12 +24,6 @@
</div>
</div>
<script>
async function getMagicUrl() {
let v = localStorage.GoGoUrl;
if(v && v.startsWith("http")) return v;
return "https://mybing2.xn--xyza.top/";
}
const magicUrl = getMagicUrl();
const inputDraw = document.getElementById('inputDraw');
const imgsDiv = document.getElementById('imgs');
async function draw() {

View File

@ -18,7 +18,7 @@ async function generateImages(text,requestId,countF){
let theUrl = magicUrl+`images/create?${theUrls.toString()}`;
let response = await fetch(theUrl);
let html = (await response.text());
let cookieID = response.headers.get('cookieID');
//let cookieID = response.headers.get('cookieID');
//如果返回的是有错误的页面
let urr = new RegExp('class="gil_err_mt">([^<>]*)</div>').exec(html);
@ -47,7 +47,7 @@ async function generateImages(text,requestId,countF){
await sleep(3000);
let imgPageHtml;
try{
imgPageHtml = (await (await fetch(imgPageHtmlUrl,{headers:{"cookieID":cookieID}})).text());
imgPageHtml = (await (await fetch(imgPageHtmlUrl)).text());
}catch(e){
console.error(e);
}