PawanOsman / GoogleBard

GoogleBard - A reverse engineered API for Google Bard chatbot for NodeJS
https://bard.google.com
MIT License
415 stars 57 forks source link

Empty response when the query includes a url #30

Open nerblock opened 1 year ago

nerblock commented 1 year ago

The response is empty when the query includes a link to a webpage. For example try this query:

Can you summarize this article for me? https://blog.google/technology/ai/code-with-bard/

This happens because resData[3] contains an empty string. To get the actual response text the ask method needs to be modified to return resData[1]:

    async ask(prompt, conversationId) {
        let resData = await this.send(prompt, conversationId);
        return resData[3].length > 0 ? resData[3] : resData[1];
    }