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

local Bing correctly, but server does not work

Open yuwangi opened this issue 2 years ago • 5 comments

I'm running into some issues, When I deploy locally bing returns correctly, When I deploy on the server but no results are returned, Have you ever encountered this? I guarantee the code is exactly the same

yuwangi avatar Feb 16 '23 03:02 yuwangi

On the server, try doing a curl GET request to https://www.bing.com/turing/conversation/create. You should see Sorry, you are not allowed to access this service if it works, but maybe Bing blocks some IPs from VPS networks entirely.

waylaidwanderer avatar Feb 16 '23 03:02 waylaidwanderer

I tried it and found that my host is cn.bing.com, so can I support the configuration of host? 1676524981980

yuwangi avatar Feb 16 '23 05:02 yuwangi

@yuwangi Can you first turn on debug mode for the Bing client and try it on the server? Let me know what the console shows.

waylaidwanderer avatar Feb 16 '23 06:02 waylaidwanderer

国内ip会强制跳转cn.bing.com不支持bingAI 你可以尝试host能否解决 如果不行就需要翻墙

ndwzy avatar Feb 16 '23 08:02 ndwzy

@waylaidwanderer
I tried it, changing the server code to cn.bing.com is ok. I originally wanted to try to use nginx reverse proxy directly, but the cookie and authentication information will be discarded, so I hope to support host customization, thks

yuwangi avatar Feb 16 '23 12:02 yuwangi

In setting.js I defined the host: 'https://cn.bing.com', But it is not work ReferenceError: host is not defined at BingAIClient.createNewConversation (file:///var/chatgpt-api/src/BingAIClient.js:19:41) at BingAIClient.sendMessage (file:///var/chatgpt-api/src/BingAIClient.js:120:62) at Object. (file:///var/chatgpt-api/bin/server.js:97:31) at preHandlerCallback (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:128:37) at preValidationCallback (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:112:5) at handler (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:76:7) at /var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:192:9 at AsyncResource.runInAsyncScope (node:async_hooks:203:9) at done (/var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:186:14) at Parser.defaultJsonParser [as fn] (/var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:292:5) ReferenceError: host is not defined at BingAIClient.createNewConversation (file:///var/chatgpt-api/src/BingAIClient.js:19:41) at BingAIClient.sendMessage (file:///var/chatgpt-api/src/BingAIClient.js:120:62) at Object. (file:///var/chatgpt-api/bin/server.js:97:31) at preHandlerCallback (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:128:37) at preValidationCallback (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:112:5) at handler (/var/chatgpt-api/node_modules/fastify/lib/handleRequest.js:76:7) at /var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:192:9 at AsyncResource.runInAsyncScope (node:async_hooks:203:9) at done (/var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:186:14) at Parser.defaultJsonParser [as fn] (/var/chatgpt-api/node_modules/fastify/lib/contentTypeParser.js:292:5)

eu09 avatar Feb 17 '23 10:02 eu09

@eu09 Oops, thanks for catching that. Fixed in 1.17.6.

waylaidwanderer avatar Feb 17 '23 10:02 waylaidwanderer