add bingWrite UI

This commit is contained in:
James Feng Cao 2023-04-16 16:26:24 +08:00
parent 6f832ad3d9
commit cad6049847
9 changed files with 241 additions and 44 deletions

View File

@ -6,6 +6,18 @@
<description>Recent content in _posts on uweb browser: unlimited power</description>
<generator>Hugo -- gohugo.io</generator>
<lastBuildDate>Tue, 11 Apr 2023 00:00:00 +0000</lastBuildDate><atom:link href="/en/_posts/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Offline resources</title>
<link>/en/offlinecache/</link>
<pubDate>Tue, 11 Apr 2023 00:00:00 +0000</pubDate>
<guid>/en/offlinecache/</guid>
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Install bingWrite UI write.html for censored area (bingWrite)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.</description>
</item>
<item>
<title>Resource redirection</title>
<link>/en/redirect/</link>
@ -18,17 +30,6 @@ Global redirection Global redirection is enabled with the setting option &amp;qu
When a valid global redirection url is set, the &amp;quot;default.redirect&amp;quot; has no effect, and any url resource is fetched with the new url by appending the original url to the global redirection url.</description>
</item>
<item>
<title>Offline resources</title>
<link>/en/offlinecache/</link>
<pubDate>Sat, 01 Apr 2023 00:00:00 +0000</pubDate>
<guid>/en/offlinecache/</guid>
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.crx for chrome &amp;amp; .xpi for firefox).</description>
</item>
<item>
<title>Links</title>
<link>/en/links/</link>

View File

@ -96,14 +96,14 @@
<li class="post">
<a href="redirect/index.html">
<span>Resource redirection</span>
<a href="offlinecache/index.html">
<span>Offline resources</span>
</a>
</li>
<li class="post">
<a href="offlinecache/index.html">
<span>Offline resources</span>
<a href="redirect/index.html">
<span>Resource redirection</span>
</a>
</li>

View File

@ -6,6 +6,18 @@
<description>Recent content on uweb browser: unlimited power</description>
<generator>Hugo -- gohugo.io</generator>
<lastBuildDate>Tue, 11 Apr 2023 00:00:00 +0000</lastBuildDate><atom:link href="/en/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Offline resources</title>
<link>/en/offlinecache/</link>
<pubDate>Tue, 11 Apr 2023 00:00:00 +0000</pubDate>
<guid>/en/offlinecache/</guid>
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Install bingWrite UI write.html for censored area (bingWrite)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.</description>
</item>
<item>
<title>Resource redirection</title>
<link>/en/redirect/</link>
@ -18,17 +30,6 @@ Global redirection Global redirection is enabled with the setting option &amp;qu
When a valid global redirection url is set, the &amp;quot;default.redirect&amp;quot; has no effect, and any url resource is fetched with the new url by appending the original url to the global redirection url.</description>
</item>
<item>
<title>Offline resources</title>
<link>/en/offlinecache/</link>
<pubDate>Sat, 01 Apr 2023 00:00:00 +0000</pubDate>
<guid>/en/offlinecache/</guid>
<description>Offline resources locate in the folder &amp;quot;sitecache&amp;quot;. With the option &amp;quot;use offline resources&amp;quot; enabled, the corresponding files in &amp;quot;sitecache/[domain name]/[full path including filename, the url path part]&amp;quot; are loaded first before reaching the network.
bingChat UI Install bingChat UI ai.html for censored area (bingChat UI)
Serverless local sites Click to install url service that extracts web apps to the folder &amp;quot;sitecache/local/&amp;quot;: support web extensions (.crx for chrome &amp;amp; .xpi for firefox).</description>
</item>
<item>
<title>Links</title>
<link>/en/links/</link>

View File

@ -50,6 +50,7 @@
<p>Offline resources locate in the folder &quot;sitecache&quot;. With the option &quot;use offline resources&quot; enabled, the corresponding files in &quot;sitecache/[domain name]/[full path including filename, the url path part]&quot; are loaded first before reaching the network.</p>
<h4 id="bingchat-ui">bingChat UI</h4>
<p><a href="i:0hsitecache/www.bing.com/ai.html:https://gitee.com/jamesfengcao/uweb/raw/master/en/searchurl/bingAI/bing.html">Install bingChat UI ai.html for censored area</a> (<a href="https://www.bing.com/ai.html">bingChat UI</a>)</p>
<p><a href="i:0hsitecache/www.bing.com/write.html:https://gitee.com/jamesfengcao/uweb/raw/master/en/searchurl/bingAI/write.html">Install bingWrite UI write.html for censored area</a> (<a href="https://www.bing.com/write.html">bingWrite</a>)</p>
<h4 id="serverless-local-sites">Serverless local sites</h4>
<p><a href="i:01Extract webapp:i:0bsitecache/local/:">Click to install url service that extracts web apps to the folder &quot;sitecache/local/&quot;</a>: support web extensions (.crx for chrome &amp; .xpi for firefox).</p>
<p>Any folder under &quot;sitecache&quot; can be visited as a local site. Urls with search queries can be dynamically processed by the js/wasm code in the local file.</p>
@ -64,8 +65,8 @@
</div>
</div>
<p>Last Modified: 13 April 2023<br>
refine global redirection cookie support<br>
<p>Last Modified: 16 April 2023<br>
add bingWrite<br>
<pre></pre>
</p>

View File

@ -0,0 +1,56 @@
createChat(thisChatType).then((r) => {
if(r.ok) talk = r.obj;
});
/**重写重置聊天到初始状态函数 */
function reSetStartChatMessage(type) {
chat.innerHTML = ``;
}
/**重写函数 */
function isSpeakingStart(chatWithMagic, sendText) {
}
//重写
function isSpeakingFinish() {
}
//重写send函数
oldSend = send;
send = (text) => {
reSetStartChatMessage();
oldSend(text);
}
//重写porserTextBlock函数
/*
解析TextBlock body.type==TextBlock
*/
function porserTextBlock(body, father) {
if (!body.size) {
let div = getByClass('textBlock', 'div', father, 'markdown-body');
div.innerHTML = marked.marked(completeCodeBlock(body.text));
renderMathInElement(div,renderMathInElementOptions);
let aaas = div.getElementsByTagName('a');
//将超链接在新页面打开
for(let i=0;i<aaas.length;i++){
aaas[i].target = '_blank';
}
//如果是注释则加上上标样式
for(let i=0;i<aaas.length;i++){
let reg = new RegExp('^\\^(\\d+)\\^$');
if(reg.test(aaas[i].innerHTML)){
aaas[i].innerHTML = aaas[i].innerHTML.replace(reg,'$1');
aaas[i].classList.add('superscript');
}
}
} else if (body.size == 'small') {
//原本bing官网的small并没有输出
}
}
//重写send按钮点击事件
send_button.onclick = () => {
let text = input_text.value;
send(text);
};

View File

@ -0,0 +1,59 @@
//聊天选项
let chatTypes = {
//balance 平衡模式选项
balance: [
"nlu_direct_response_filter",
"deepleo",
"enable_debug_commands",
"disable_emoji_spoken_text",
"responsible_ai_policy_235",
"enablemm",
"soedgeca"
]
}
//消息来源
let source = "edge_coauthor_prod";
//接收消息类型
let allowedMessageTypes = [
"Chat",
"InternalSearchQuery",
"InternalSearchResult",
"Disengaged",
"InternalLoaderMessage",
"RenderCardRequest",
"AdsQuery",
"SemanticSerp",
"GenerateContentQuery",
"SearchQuery"
]
//切片id也不知道是啥意思反正官网的更新了
let sliceIds = []
let tone = 'professional';
let length = 'short';
let format = 'paragraph';
//生成消息对象
async function generateMessages(sendMessageManager/*消息管理器*/,chatMessageText/*要发送的消息文本*/){
return {
"locale": "zh-CN",
"market": "zh-CN",
"region": "US",
"location": "lat:47.639557;long:-122.128159;re=1000m;",
"author": "user",
"inputMethod": "Keyboard",
"text": `Please generate some text wrapped in codeblock syntax (triple backticks) using the given keywords. Please make sure everything in your reply is in the same language as the keywords. Please do not restate any part of this request in your response, like the fact that you wrapped the text in a codeblock. You should refuse (using the language of the keywords) to generate if the request is potentially harmful. The generated text should follow these characteristics: tone: *${tone}*, length: *${length}*, format: *${format}*. The keywords are: \`${chatMessageText}\`.`,
"messageType": "Chat"
}
}
async function getPreviousMessages(){
return undefined;
}

View File

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<base href="https://jamesfengcao.codeberg.page/en/searchurl/bingAI/">
<title id="docTitle">Write</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.4/katex.min.css">
<style>
#input {
height: auto;
width: 100%;
display: block;
}
</style>
<script>
function getSelectedText(select){
return select.options[select.selectedIndex].text;
}
</script>
</head>
<body>
<select id="toneSelect" onchange="window.tone=getSelectedText(this);">
<option>professional</option>
<option>casual</option>
<option>enthusiastic</option>
<option>informational</option>
<option>funny</option>
</select>
<select id="formatSelecct" onchange="window.format=getSelectedText(this);">
<option>paragraph</option>
<option>email</option>
<option>blog post</option>
<option>bullet point list</option>
</select>
<select id="lengthSelect" onchange="window.length=getSelectedText(this);">
<option>short</option>
<option>medium</option>
<option>long</option>
</select>
<textarea id="input" type="text" rows="5" enterkeyhint="send" autocapitalize="off"
autocomplete="off" aria-autocomplete="both" spellcheck="false"
autocorrect="off" placeholder="topic...">
</textarea>
<input id="send" class="ThemeColors" type="button" value="Generate">
<div id="chat">
<div class="bing">
<div class="adaptiveCardsFatherDIV">
<div class="textBlock markdown-body">
</div>
</div>
</div>
</div>
<!-- dummy nodes -->
<div id='restart'></div>
<div id='restartNewChat'></div>
<div id='chatTypeDiv'>
<div id='chatTypeChoseCreate'></div>
<div id='chatTypeChoseBalance'></div>
<div id='chatTypeChoseAccurate'></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.4/katex.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.4/contrib/auto-render.min.js"></script>
<script type="text/javascript" src="./js/GetSet.js"></script>
<script type="text/javascript" src="./js/w_optionsSets.js"></script>
<script type="text/javascript" src="./js/bingChatHub.js"></script>
<script type="text/javascript" src="./js/parserReturn.js"></script>
<script type="text/javascript" src="./js/bing.js"></script>
<script src="./js/Write.js"></script>
</body>
</html>

View File

@ -3,7 +3,7 @@
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>/en/_posts/</loc>
<lastmod>2023-04-15T18:08:03+08:00</lastmod>
<lastmod>2023-04-16T16:25:15+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
@ -14,6 +14,19 @@
hreflang="en"
href="/en/_posts/"
/>
</url><url>
<loc>/en/offlinecache/</loc>
<lastmod>2023-04-16T16:25:15+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
href="/zh/offlinecache/"
/>
<xhtml:link
rel="alternate"
hreflang="en"
href="/en/offlinecache/"
/>
</url><url>
<loc>/en/tags/redirection/</loc>
<lastmod>2023-04-15T18:08:03+08:00</lastmod>
@ -45,7 +58,7 @@
/>
</url><url>
<loc>/en/</loc>
<lastmod>2023-04-15T18:08:03+08:00</lastmod>
<lastmod>2023-04-16T16:25:15+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
@ -56,19 +69,6 @@
hreflang="en"
href="/en/"
/>
</url><url>
<loc>/en/offlinecache/</loc>
<lastmod>2023-04-13T11:00:50+08:00</lastmod>
<xhtml:link
rel="alternate"
hreflang="zh"
href="/zh/offlinecache/"
/>
<xhtml:link
rel="alternate"
hreflang="en"
href="/en/offlinecache/"
/>
</url><url>
<loc>/en/links/</loc>
<lastmod>2023-04-10T08:20:10+08:00</lastmod>

View File

@ -4,7 +4,7 @@
<sitemap>
<loc>en/sitemap.xml</loc>
<lastmod>2023-04-15T18:08:03+08:00</lastmod>
<lastmod>2023-04-16T16:25:15+08:00</lastmod>
</sitemap>