Compare commits

...

2 commits

Author SHA1 Message Date
James Feng Cao
ad4cc42d67 bingAI fix 2023-04-25 19:34:37 +08:00
James Feng Cao
8f2c1c9ad0 bingAI fix 2023-04-25 19:08:18 +08:00
8 changed files with 72 additions and 53 deletions

View file

@ -17,7 +17,7 @@
<input id="restartNewChat" class="onShow" type="button" value="new chat"> <input id="restartNewChat" class="onShow" type="button" value="new chat">
<input id="restart" type="button" value="🧹"> <input id="restart" type="button" value="🧹">
<div id="input-div"> <div id="input-div">
<textarea id="input" type="text" enterkeyhint="send" maxlength="2000" autocapitalize="off" autocomplete="off" aria-autocomplete="both" spellcheck="false" aria-label="ask Bing" autocorrect="off" placeholder="type question here..."></textarea> <textarea id="input" type="text" enterkeyhint="send" autocapitalize="off" autocomplete="off" aria-autocomplete="both" spellcheck="false" aria-label="ask Bing" autocorrect="off" placeholder="type question here..."></textarea>
<input id="send" type="button" value="✓"> <input id="send" type="button" value="✓">
</div> </div>

View file

@ -7,6 +7,11 @@ var send_button = document.getElementById('send');
let restartNewChat = document.getElementById('restartNewChat'); let restartNewChat = document.getElementById('restartNewChat');
var thisChatType = chatTypes.balance; var thisChatType = chatTypes.balance;
//全局变量
var talk;
var returnMessage;
var isSpeaking = false;
reSetStartChatMessage(); reSetStartChatMessage();
//(string) //(string)
@ -49,7 +54,6 @@ function onMessage(json, returnMessage) {
onMessageIsOKClose = true; onMessageIsOKClose = true;
returnMessage.getCatWebSocket().close(1000, 'ok'); returnMessage.getCatWebSocket().close(1000, 'ok');
} else { } else {
talk = undefined;
localStorage.removeItem('LastChatJson'); localStorage.removeItem('LastChatJson');
if (json.type == 1) { if (json.type == 1) {
porserArguments(json.arguments); porserArguments(json.arguments);
@ -78,13 +82,6 @@ input_text.addEventListener('keydown', (event) => {
} }
}); });
//全局变量
var talk;
var returnMessage;
var isSpeaking = false;
/**重置聊天框和聊天建议到初始状态 */ /**重置聊天框和聊天建议到初始状态 */
function reSetStartChatMessage(type) { function reSetStartChatMessage(type) {
createChat(thisChatType).then((r) => { createChat(thisChatType).then((r) => {
@ -298,5 +295,14 @@ restartNewChat.onclick = async () => {
restart_button.onclick(); restart_button.onclick();
} }
async function searchSuggestionsAddOnclick(){
let adds = document.querySelectorAll("#SearchSuggestions>a");
for(let add in adds){
adds[add].onclick = (event)=>{
if(searchSuggestions.style.opacity>=1){
send(event.target.innerHTML);
}
}
}
}

View file

@ -196,29 +196,38 @@ function generateContentQueryImg(message, father){
theUrls.append('SFX', '2'); theUrls.append('SFX', '2');
theUrls.append('q', message.text); theUrls.append('q', message.text);
theUrls.append('iframeid', message.requestId); theUrls.append('iframeid', message.requestId);
let theUrl = URLTrue(magicUrl,"AiDraw/Create?") + theUrls.toString(); let theUrl = URLTrue(magicUrl,"images/create?") + theUrls.toString();
try{ try{
father.innerHTML = `正在生成${message.text}的图片.`; father.innerHTML = `正在生成${message.text}的图片.`;
let html = (await (await fetch(theUrl)).text()); let html = (await (await fetch(theUrl)).text());
let urr = new RegExp('"/(images/create/async/results/(\\S*))"').exec(html);
if(!urr || !urr[1]){ //如果有错误就输出错误
urr = new RegExp('class="gil_err_mt">([^<>]*)</div>').exec(html); let urr = new RegExp('class="gil_err_mt">([^<>]*)</div>').exec(html);
if(urr || urr[1]){ if(urr && urr[1]){
father.innerHTML = `${urr[1]}` father.innerHTML = `<h3>${urr[1]}</h3>`
return; urr = new RegExp('class="gil_err_sbt">(([^<>]*<(a|div)[^<>]*>[^<>]*</(a|div)>[^<>]*)*)</div>').exec(html);
if(urr && urr[1]){
father.innerHTML = father.innerHTML+`<p>${urr[1]}</p>`;
} }
return;
}
//如果没错误就匹配链接获取图片
urr = new RegExp('"/(images/create/async/results/(\\S*))"').exec(html);
if(!urr || !urr[1]){
console.log(html); console.log(html);
addError("请求图片返回不正确的页面,无法加载图片。"); addError("请求图片返回不正确的页面,无法加载图片。");
return; return;
} }
let ur = urr[1]; let ur = urr[1];
ur = ur.replaceAll('&amp;','&');
let imgPageHtmlUrl = URLTrue(magicUrl,ur); let imgPageHtmlUrl = URLTrue(magicUrl,ur);
let count = 0; let count = 0;
let run = async ()=>{ let run = async ()=>{
father.innerHTML = `正在生成${message.text}的图片.${count}`; father.innerHTML = `正在生成${message.text}的图片.${count}`;
if(count>20){ if(count>20){
addError("请求图片超时!"); father.innerHTML = "请求图片超时!";
return; return;
} }
count++; count++;
@ -232,22 +241,29 @@ function generateContentQueryImg(message, father){
setTimeout(run,3000); setTimeout(run,3000);
return; return;
} }
let div = document.createElement("div");
div.innerHTML = imgPageHtml; father.innerHTML = '';
let imgs = div.getElementsByTagName("img");
let theUrls = new URLSearchParams(); let theUrls = new URLSearchParams();
theUrls.append('createmessage',message.text); theUrls.append('createmessage',message.text);
father.innerHTML = ''; let a = document.createElement("a");
for(let el=0;el<imgs.length;el++){ father.appendChild(a);
let img = document.createElement('img'); //用正则找全部图片
img.src = imgs[el].src; let allSrc = imgPageHtml.matchAll(/<img[^<>]*src="([^"]*)"[^<>]*>/g);
theUrls.append('imgs',img.src.split('?')[0]); let src = undefined;
img.onclick = ()=>{ let ok = false;
window.open('chrome-extension://'+chrome.runtime.id+'/GeneratePicture/img.html?'+theUrls.toString(), '_blank'); while(!(src=allSrc.next()).done){
} ok =true;
father.appendChild(img); theUrls.append('imgs',src.value[1].split('?')[0]);
let img = document.createElement("img");
img.src = src.value[1];
a.appendChild(img);
}
if(ok){
a.target = '_blank';
a.href = '../GeneratePicture/img.html?'+theUrls.toString();
}else{
father.innerHTML = "服务器未正常返回图片!";
} }
div.remove();
} }
setTimeout(run,3000); setTimeout(run,3000);
@ -396,11 +412,7 @@ function porserSuggestedResponses(suggestedResponses) {
for (let i = 0; i < suggestedResponses.length; i++) { for (let i = 0; i < suggestedResponses.length; i++) {
let a = document.createElement('a'); let a = document.createElement('a');
a.innerHTML = suggestedResponses[i].text; a.innerHTML = suggestedResponses[i].text;
a.onclick = (even) => {
if(searchSuggestions.style.opacity>=1){
send(even.target.innerHTML);
}
}
searchSuggestions.appendChild(a); searchSuggestions.appendChild(a);
} }
searchSuggestionsAddOnclick();
} }

View file

@ -11,7 +11,7 @@
<sitemap> <sitemap>
<loc>zh/sitemap.xml</loc> <loc>zh/sitemap.xml</loc>
<lastmod>2023-04-19T23:06:34+08:00</lastmod> <lastmod>2023-04-22T18:03:41+08:00</lastmod>
</sitemap> </sitemap>

View file

@ -157,7 +157,6 @@ UA为非默认时点击PC按钮将恢复UA为默认同时触发不保存UA
<guid>/zh/search/</guid> <guid>/zh/search/</guid>
<description>超微浏览器下点击搜索引擎配置链接可自动添加到主屏。 <description>超微浏览器下点击搜索引擎配置链接可自动添加到主屏。
推荐引擎(将下面文本添加到home5.search中) 推荐引擎(将下面文本添加到home5.search中)
bingChat:i:92X-Forwarded-For;8.8.8.8;User-Agent;Mobile Safari EdgA/111.0.1624.80:https://www.bing.com/search?q=
顺序:i:40%s_00 顺序:i:40%s_00
apkdl:https://apkdl.in/app/search?q= apkdl:https://apkdl.in/app/search?q=
apkbog:https://www.apkbog.com/en/apks/search/ apkbog:https://www.apkbog.com/en/apks/search/
@ -194,8 +193,6 @@ toplinks:https://www.toplinks.cc/s/?keyword=
google:https://google.com/search?q= google:https://google.com/search?q=
谷歌:https://谷歌.ml/search?q= 谷歌:https://谷歌.ml/search?q=
必应:https://www.bing.com/search?q= 必应:https://www.bing.com/search?q=
bingUS:i:92X-Forwarded-For;8.8.8.8:https://www.bing.com/search?q=
简单搜索:i:92User-Agent;SearchCraft:https://m.baidu.com/s?wd=
百度:https://m.baidu.com/s?wd= 百度:https://m.baidu.com/s?wd=
Fsou:https://fsoufsou.com/search?q= Fsou:https://fsoufsou.com/search?q=
neeva:https://neeva.com/search?q= neeva:https://neeva.com/search?q=
@ -219,7 +216,12 @@ libvio:https://libvio.me/search/-------------.html?wd=
努努影院:https://www.nunuyy.top/so/%s---.html 努努影院:https://www.nunuyy.top/so/%s---.html
louk:https://www.louk.cn/vodsearch/-------------.html?wd= louk:https://www.louk.cn/vodsearch/-------------.html?wd=
4444影视:http://k.4444.li/search.php?searchword= 4444影视:http://k.4444.li/search.php?searchword=
nfmovies:https://www.nfmovies.com/search.php?searchword=</description> nfmovies:https://www.nfmovies.com/search.php?searchword=
电影狗:https://www.dianyinggou.com/so/
pianku:https://www.pianku.la/search/%s-------------.html
novip:https://www.novipnoad.com/s=
555dianying:https://555dianying.cc/vodsearch/-------------.html?wd=
zhenbuka:https://www.zhenbuka.net/search/-------------.html?wd=</description>
</item> </item>
<item> <item>

View file

@ -49,7 +49,6 @@
</ul> </ul>
<p><a href="../index.html">超微浏览器</a>下点击搜索引擎配置链接可自动添加到主屏。</p> <p><a href="../index.html">超微浏览器</a>下点击搜索引擎配置链接可自动添加到主屏。</p>
<p>推荐引擎(将下面文本添加到home5.search中)</p> <p>推荐引擎(将下面文本添加到home5.search中)</p>
<p><a href="i:00bingChat:i:92X-Forwarded-For;8.8.8.8;User-Agent;Mobile Safari EdgA/111.0.1624.80:https://www.bing.com/search?q=">bingChat:i:92X-Forwarded-For;8.8.8.8;User-Agent;Mobile Safari EdgA/111.0.1624.80:https://www.bing.com/search?q=</a></p>
<p><a href="i:00顺序:i:40%s_00">顺序:i:40%s_00</a></p> <p><a href="i:00顺序:i:40%s_00">顺序:i:40%s_00</a></p>
<p><a href="i:00apkdl:https://apkdl.in/app/search?q=">apkdl:https://apkdl.in/app/search?q=</a></p> <p><a href="i:00apkdl:https://apkdl.in/app/search?q=">apkdl:https://apkdl.in/app/search?q=</a></p>
<p><a href="i:00apkbog:https://www.apkbog.com/en/apks/search/">apkbog:https://www.apkbog.com/en/apks/search/</a></p> <p><a href="i:00apkbog:https://www.apkbog.com/en/apks/search/">apkbog:https://www.apkbog.com/en/apks/search/</a></p>
@ -91,8 +90,6 @@
<a href="i:00google:https://google.com/search?q=">google:https://google.com/search?q=</a></p> <a href="i:00google:https://google.com/search?q=">google:https://google.com/search?q=</a></p>
<p><a href="i:00谷歌:https://谷歌.ml/search?q=">谷歌:https://谷歌.ml/search?q=</a></p> <p><a href="i:00谷歌:https://谷歌.ml/search?q=">谷歌:https://谷歌.ml/search?q=</a></p>
<p><a href="i:00必应:https://www.bing.com/search?q=">必应:https://www.bing.com/search?q=</a></p> <p><a href="i:00必应:https://www.bing.com/search?q=">必应:https://www.bing.com/search?q=</a></p>
<p><a href="i:00bingUS:i:92X-Forwarded-For;8.8.8.8:https://www.bing.com/search?q=">bingUS:i:92X-Forwarded-For;8.8.8.8:https://www.bing.com/search?q=</a></p>
<p><a href="i:00简单搜索:i:92User-Agent;SearchCraft:https://m.baidu.com/s?wd=">简单搜索:i:92User-Agent;SearchCraft:https://m.baidu.com/s?wd=</a></p>
<p><a href="i:00百度:https://m.baidu.com/s?wd=">百度:https://m.baidu.com/s?wd=</a></p> <p><a href="i:00百度:https://m.baidu.com/s?wd=">百度:https://m.baidu.com/s?wd=</a></p>
<p><a href="i:00Fsou:https://fsoufsou.com/search?q=">Fsou:https://fsoufsou.com/search?q=</a></p> <p><a href="i:00Fsou:https://fsoufsou.com/search?q=">Fsou:https://fsoufsou.com/search?q=</a></p>
<p><a href="i:00neeva:https://neeva.com/search?q=">neeva:https://neeva.com/search?q=</a></p> <p><a href="i:00neeva:https://neeva.com/search?q=">neeva:https://neeva.com/search?q=</a></p>
@ -302,8 +299,8 @@
<a href="https://www.zhihu.com/question/20251786">有哪些特殊的搜索引擎</a></p> <a href="https://www.zhihu.com/question/20251786">有哪些特殊的搜索引擎</a></p>
</div> </div>
<p>Last Modified: 13 March 2023<br> <p>Last Modified: 22 April 2023<br>
add newbing tips<br> fix bingAI always 1/20 issue<br>
<pre></pre> <pre></pre>
</p> </p>

View file

@ -29,7 +29,7 @@
/> />
</url><url> </url><url>
<loc>/zh/</loc> <loc>/zh/</loc>
<lastmod>2023-04-19T23:06:34+08:00</lastmod> <lastmod>2023-04-22T18:03:41+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"
@ -126,7 +126,7 @@
/> />
</url><url> </url><url>
<loc>/zh/topposts/</loc> <loc>/zh/topposts/</loc>
<lastmod>2023-03-13T10:49:42+08:00</lastmod> <lastmod>2023-04-22T18:03:41+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"
@ -139,7 +139,7 @@
/> />
</url><url> </url><url>
<loc>/zh/search/</loc> <loc>/zh/search/</loc>
<lastmod>2023-03-13T10:49:42+08:00</lastmod> <lastmod>2023-04-22T18:03:41+08:00</lastmod>
<xhtml:link <xhtml:link
rel="alternate" rel="alternate"
hreflang="en" hreflang="en"

View file

@ -14,7 +14,6 @@
<guid>/zh/search/</guid> <guid>/zh/search/</guid>
<description>超微浏览器下点击搜索引擎配置链接可自动添加到主屏。 <description>超微浏览器下点击搜索引擎配置链接可自动添加到主屏。
推荐引擎(将下面文本添加到home5.search中) 推荐引擎(将下面文本添加到home5.search中)
bingChat:i:92X-Forwarded-For;8.8.8.8;User-Agent;Mobile Safari EdgA/111.0.1624.80:https://www.bing.com/search?q=
顺序:i:40%s_00 顺序:i:40%s_00
apkdl:https://apkdl.in/app/search?q= apkdl:https://apkdl.in/app/search?q=
apkbog:https://www.apkbog.com/en/apks/search/ apkbog:https://www.apkbog.com/en/apks/search/
@ -51,8 +50,6 @@ toplinks:https://www.toplinks.cc/s/?keyword=
google:https://google.com/search?q= google:https://google.com/search?q=
谷歌:https://谷歌.ml/search?q= 谷歌:https://谷歌.ml/search?q=
必应:https://www.bing.com/search?q= 必应:https://www.bing.com/search?q=
bingUS:i:92X-Forwarded-For;8.8.8.8:https://www.bing.com/search?q=
简单搜索:i:92User-Agent;SearchCraft:https://m.baidu.com/s?wd=
百度:https://m.baidu.com/s?wd= 百度:https://m.baidu.com/s?wd=
Fsou:https://fsoufsou.com/search?q= Fsou:https://fsoufsou.com/search?q=
neeva:https://neeva.com/search?q= neeva:https://neeva.com/search?q=
@ -76,7 +73,12 @@ libvio:https://libvio.me/search/-------------.html?wd=
努努影院:https://www.nunuyy.top/so/%s---.html 努努影院:https://www.nunuyy.top/so/%s---.html
louk:https://www.louk.cn/vodsearch/-------------.html?wd= louk:https://www.louk.cn/vodsearch/-------------.html?wd=
4444影视:http://k.4444.li/search.php?searchword= 4444影视:http://k.4444.li/search.php?searchword=
nfmovies:https://www.nfmovies.com/search.php?searchword=</description> nfmovies:https://www.nfmovies.com/search.php?searchword=
电影狗:https://www.dianyinggou.com/so/
pianku:https://www.pianku.la/search/%s-------------.html
novip:https://www.novipnoad.com/s=
555dianying:https://555dianying.cc/vodsearch/-------------.html?wd=
zhenbuka:https://www.zhenbuka.net/search/-------------.html?wd=</description>
</item> </item>
<item> <item>