node-chatgpt-api icon indicating copy to clipboard operation
node-chatgpt-api copied to clipboard

Agent error

Open zhouxinhao1208 opened this issue 1 year ago • 3 comments

TypeError: HttpsProxyAgent is not a constructor at file:///C:/Users/Administrator/Desktop/node-chatgpt-api/src/BingAIClient.js:96:25 at new Promise () at BingAIClient.createWebSocketConnection (file:///C:/Users/Administrator/Desktop/node-chatgpt-api/src/BingAIClient.js:93:16) at BingAIClient.sendMessage (file:///C:/Users/Administrator/Desktop/node-chatgpt-api/src/BingAIClient.js:280:31) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async onMessage (file:///C:/Users/Administrator/Desktop/node-chatgpt-api/bin/cli.js:170:26) at async file:///C:/Users/Administrator/Desktop/node-chatgpt-api/bin/cli.js:97:1 Type "!" to access the command menu. ? Write a message: ​

zhouxinhao1208 avatar May 06 '23 13:05 zhouxinhao1208

I tried this, it works https://stackoverflow.com/questions/53419610/how-do-i-use-a-proxy-with-node-and-esm

andrewson253 avatar May 06 '23 16:05 andrewson253

I can give you a chinese answer。 我遇到了同样的错误,确认是 https-proxy-agent升级后的不兼容问题,你可以删掉重新安装老版本试一下,我的已经回复正常了

hupimaodaren avatar May 07 '23 03:05 hupimaodaren

Same,You can fix it Just like @andrewson253 say. Open ./src/BingAIClient.js At the 6 line import HttpsProxyAgent from 'https-proxy-agent'; change it to import {HttpsProxyAgent} from 'https-proxy-agent'; And it's fixed.

Czx1235 avatar May 07 '23 04:05 Czx1235