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

Problem opening inMemory #14

Closed boygoboy closed 1 year ago

boygoboy commented 1 year ago

const bardUnofficalChat=async (req,res)=>{ let {message}=req.body const {Bard} = await import("googlebard")

let cookies = __Secure-1PSID=${process.env.BARD_AUTH};

let bot = new Bard(cookies, { inMemory: false, // optional: if true, it will not save conversations to disk savePath: "./chatjson/conversations.json", // optional: path to save conversations });

let conversationId = "conversation name"; // optional: to make it remember the conversation

// let response = await bot.ask(message); // conversationId is optional // console.log(response); // res.json({ // data:response // })

// Simulating response streaming await bot.askStream( (res) => { console.log(res); }, message, // conversationId, ); }

module.exports={ bardUnofficalChat }

I ran the above code and found that adding { inMemory: false, // optional: if true, it will not save conversations to disk savePath: "./chatjson/conversations.json", // optional: path to save conversations } With this code, node will be restarted due to changes in the file, resulting in the inability to output chat messages. Then I configure { in nodemon.json "ignore": [ "chatjson/*" ] } It doesn't work either, do you guys know how to solve it?

PawanOsman commented 1 year ago

Can you show us the error that happens while it restarts? did you set read and write permissions for the path you specify in savePath?

boygoboy commented 1 year ago

Maybe the file path I set nodemon to ignore monitoring is wrong, and it runs normally on another computer

PawanOsman commented 1 year ago

Maybe the file path I set nodemon to ignore monitoring is wrong, and it runs normally on another computer

thank you, I found the problem was read/write permissions for the file directory, fixed in the latest version (1.0.6)

boygoboy commented 1 year ago

Maybe the file path I set nodemon to ignore monitoring is wrong, and it runs normally on another computer

thank you, I found the problem was read/write permissions for the file directory, fixed in the latest version (1.0.6)

Haha I will update