Comments (3)
i've wrote a wrapper for it, it judge wether the content ends by detecting the update rate of partitial content.
i think it is a bad solution.
Anyway, I hope this bug will be fixed soon.
Here's the code, but i cant test it because it throwed a Request is throttled.
, but it should work(?).
/**
* @param { import("bing-chat").BingChat } client
* @param { string } message
* @param { import("bing-chat").ChatMessage } [session]
* @returns { Promise<import("bing-chat").ChatMessage> }
*/
function bingAiMessageSendWrapper(client, message, session) {
const TIMEOUT_THRESHOLD = 20 * 1000;
return new Promise((resolve, reject) => {
let response = {};
let responseText = '';
let temp = {
time: new Date().valueOf(),
response: response,
};
const verifyIfResponseChangedInterval = setInterval(() => {
if (new Date().valueOf() - temp.time > TIMEOUT_THRESHOLD) {
clearInterval(verifyIfResponseChangedInterval);
temp.response.text = responseText;
resolve(temp.response);
}
}, 500);
client
.sendMessage(message, {
...session,
onProgress: (partialResponse) => {
temp.response = partialResponse;
responseText += partialResponse.text;
temp.time = new Date().valueOf();
},
})
.then((response) => {
resolve(response);
})
.catch((error) => {
reject(error);
});
});
}
from bing-chat.
i've got same problem too , but there does appears answer when i add
onProgress: (partialResponse) => {
console.log(partialResponse.text);
},
though there was an answer(?), but the promise call never ends (i use await api.sendMessage
too).
from bing-chat.
so i think the best way to solve the problem without waiting for update is to use the onProgress
call.
I m trying to write some code on it , ASAP.
from bing-chat.
Related Issues (20)
- Support return AI-generated image HOT 1
- [MAJOR ISSUE] ECONNRESET & Failed to fetch, for a majority of the requests HOT 2
- Is is working ? HOT 8
- Stops working sometimes
- Unable to receive a response when asking questions in creative mode
- Bing Chat with Langchainjs
- Cookie not needed HOT 3
- ERROR in node:crypto HOT 1
- Error: unexpected HTTP error createConversation 503: Service Unavailable
- unexpected HTTP error createConversation 403 HOT 2
- MUID cookie is now required for convsersation/create? HOT 6
- feature: add support for nodejs versions older than v18 HOT 1
- Are continued conversations supported?
- Express error HOT 1
- ERROR: No Results.
- The time required to receive a response is too long HOT 1
- Is this API able to fetch results anymore? HOT 3
- Please add support for commonjs HOT 2
- Error: WebSocket error: Error: Unexpected server response: 200 HOT 18
- CAPTCHA requirements HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bing-chat.