mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
bingAI always uses magicUrl for wss://
This commit is contained in:
parent
a1f7adb7f0
commit
f536c6eb78
1 changed files with 25 additions and 25 deletions
|
@ -164,31 +164,31 @@ class Chat {
|
||||||
* 参数 消息string,当收到消息的函数,当关闭时函数
|
* 参数 消息string,当收到消息的函数,当关闭时函数
|
||||||
*/
|
*/
|
||||||
//(string,function:可以不传)
|
//(string,function:可以不传)
|
||||||
sendMessage(message, onMessage) {
|
sendMessage(message, onMessage) {
|
||||||
try {
|
try {
|
||||||
let restsrstUrl = 'wss://sydney.bing.com/sydney/ChatHub';
|
//let restsrstUrl = 'wss://sydney.bing.com/sydney/ChatHub';
|
||||||
if (this.chatWithMagic==true) {
|
//if (this.chatWithMagic==true)
|
||||||
restsrstUrl = URLTrue(this.magicUrl.replace('http', 'ws'), "ChatHub");
|
let restsrstUrl = URLTrue(this.magicUrl.replace('http', 'ws'), "sydney/ChatHub");
|
||||||
}
|
|
||||||
let chatWebSocket = new WebSocket(restsrstUrl);
|
let chatWebSocket = new WebSocket(restsrstUrl);
|
||||||
chatWebSocket.onopen = () => {
|
chatWebSocket.onopen = () => {
|
||||||
this.sendMessageManager.sendShakeHandsJson(chatWebSocket);
|
this.sendMessageManager.sendShakeHandsJson(chatWebSocket);
|
||||||
this.sendMessageManager.sendChatMessage(chatWebSocket, message);
|
this.sendMessageManager.sendChatMessage(chatWebSocket, message);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
ok: true,
|
ok: true,
|
||||||
message: 'ok',
|
message: 'ok',
|
||||||
obj: new ReturnMessage(chatWebSocket, onMessage),
|
obj: new ReturnMessage(chatWebSocket, onMessage),
|
||||||
chatWithMagic: this.chatWithMagic==true?true:false
|
chatWithMagic: this.chatWithMagic==true?true:false
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e)
|
console.warn(e)
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
message: "发生错误,可能是网络连接错误:" + e.message
|
message: "发生错误,可能是网络连接错误:" + e.message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function URLTrue(url, thiePath) {
|
function URLTrue(url, thiePath) {
|
||||||
|
|
Loading…
Reference in a new issue