Chanzhaoyu / chatgpt-web

用 Express 和 Vue3 搭建的 ChatGPT 演示网页
MIT License
31.05k stars 11.21k forks source link

用自建的反代,报 Invalid SOCKS proxy details were provided,欢迎大神们围观 #1616

Closed kwingart closed 1 year ago

kwingart commented 1 year ago

go-chatgpt-api我也成功了, go-chatgpt-api | INFO[0012] Welcome to ChatGPT chatgpt-proxy-server | [1682555989.587][INFO]: [b8f91aa06537d6526d840b389c69bda2] COMMAND ExecuteScript { chatgpt-proxy-server | "args": [ ], chatgpt-proxy-server | "script": "open('https://chat.openai.com/chat');"

这是配置文件: version: "3" services: go-chatgpt-api: container_name: go-chatgpt-api image: linweiyuan/go-chatgpt-api ports:

但是,我起chatgpt-web,配置了我自己的反代,启动是没错,只要打开web界面,与gpt互动就报错了,报无效的proxy,又不知咋整了,这里的大佬们,能指点一二么,谢谢 @Chanzhaoyu

[root@VM-20-12-centos chatgpt-web]# docker-compose up Creating network "chatgpt-web_default" with the default driver Creating chatgpt-web_app_1 ... done Attaching to chatgpt-web_app_1 app_1 | app_1 | > chatgpt-web-service@1.0.0 prod /app app_1 | > node ./build/index.mjs app_1 | app_1 | Server is running on port 3002 app_1 | POST https://172.17.0.1:8082/conversation { app_1 | body: { app_1 | action: 'next', app_1 | messages: [ [Object] ], app_1 | model: 'gpt-3.5-turbo', app_1 | parent_message_id: '08bec7ac-3fad-468f-bac8-23168416d5e1' app_1 | }, app_1 | headers: { app_1 | Authorization: 'Bearer bS92MSIsImh0dHBzOi8vb3BlbmFpLm9wZW5haS5hdXRoMGFwcC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjgxMzYyMjg0LCJleHAiOjE2ODI1NzE4ODQsImF6cCI6IlRkSkljYmUxNldvVEh0Tjk1bnl5d2g1RTR5T282SXRHIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBtb2RlbC5yZWFkIG1vZGVsLnJlcXVlc3Qgb3JnYW5pemF0aW9uLnJlYWQgb2ZmbGluZV9hY2Nlc3MifQ.U7sWfolNPSXmsDk8_iNTWgloxrOKAszwpV6YV9B20Hc4Pdsj4gZJhbJ3xUv167yOUfgat0j3k4jucYLxBGC9wlacxNVZN01gmwWOKcrrbH1LnQ0Gn0HABGo1owYACUkCqTU1YQfYPsXBqXlMZBi1v7xAvWl4AapJicyikVTz-DfVF-VgzAmac_vBcXjUkWLZGKraQIHov9_6_XSO6Df3CFD2Jz8KXCmqRM-awF0IkCl6ezMmmZif1JqpnGmjj9Hmi5SPXdNWpvfO9hWbnGr1gF7-XXw1AW9dCJCs-pvxMSJZ3VeJp-ohACofAgsQUSXKQDjBbd4Duk4WrcEpbx9WTQ', app_1 | Accept: 'text/event-stream', app_1 | 'Content-Type': 'application/json' app_1 | } app_1 | } app_1 | FetchError: request to https://172.17.0.1:8082/conversation failed, reason: Invalid SOCKS proxy details were provided. app_1 | at ClientRequest. (file:///app/node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/index.js:108:11) app_1 | at ClientRequest.emit (node:events:525:35) app_1 | at onerror (/app/node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/index.js:117:21) app_1 | at callbackError (/app/node_modules/.pnpm/agent-base@6.0.2/node_modules/agent-base/dist/src/index.js:136:17) app_1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { app_1 | type: 'system', app_1 | errno: undefined, app_1 | code: undefined, app_1 | erroredSysCall: undefined app_1 | }

Timoshao commented 1 year ago

我搭建之后 用一段时间老是提示网络错误,重启代理之后又正常。不知道啥问题导致的

gmksbk commented 1 year ago

自建代理有一种情况会出现这个问题,就是你的IP被ban然后vps通过warp抢救回来的,这个时候将账号从warp+或者plus切回warp会解决问题。。如果你的IP访问openai没有受限就不清楚了

kwingart commented 1 year ago

我的ip通过clash是可以正常访问chat.openapi.com的。

kwingart commented 1 year ago

问题解决了,用 API_REVERSE_PROXY: http://go-chatgpt-api:8082/conversation 替代 https://172.17.0.1:8082/conversation

但是现在出现新问题:

gpt没有反应,一直转圈,然后报超时 image

[root@VM-20-12-centos chatgpt-web]# docker-compose up Creating network "chatgpt-web_default" with the default driver Creating chatgpt-web_app_1 ... done Attaching to chatgpt-web_app_1 app_1 | app_1 | > chatgpt-web-service@1.0.0 prod /app app_1 | > node ./build/index.mjs app_1 | app_1 | Server is running on port 3002 app_1 | sendMessage (32 tokens) { app_1 | max_tokens: 1000, app_1 | model: 'gpt-3.5-turbo', app_1 | temperature: 0.8, app_1 | top_p: 1, app_1 | presence_penalty: 1, app_1 | messages: [ app_1 | { app_1 | role: 'system', app_1 | content: "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown." app_1 | }, app_1 | { role: 'user', content: '是否ok', name: undefined } app_1 | ], app_1 | stream: true app_1 | } app_1 | TimeoutError: OpenAI timed out waiting for response app_1 | at file:///app/node_modules/.pnpm/p-timeout@6.1.1/node_modules/p-timeout/index.js:70:24 app_1 | at new Promise () app_1 | at pTimeout (file:///app/node_modules/.pnpm/p-timeout@6.1.1/node_modules/p-timeout/index.js:48:28) app_1 | at ChatGPTAPI.sendMessage (file:///app/node_modules/.pnpm/chatgpt@5.1.2/node_modules/chatgpt/build/index.js:319:14) app_1 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) app_1 | at async chatReplyProcess (file:///app/build/index.mjs:100:22) app_1 | at async file:///app/build/index.mjs:237:5

kwingart commented 1 year ago

可以关了,这些都不是问题了。现在问题是accesstoken拿不到新的,旧的报过期。

gmksbk commented 1 year ago

怀疑你没退出登陆,直接刷新是没用的..退出重新登陆还是不行就无痕模式再登陆一次,无痕也不行的话F12进app查看前排的session token(这个不是access token)在两次登陆间有无变化

kwingart commented 1 year ago

image 无痕模式登陆后,直接打开那个网站,就出现{},没有其他任何东西。这个情况,我在其他issue里面看到过其他人反应同样问题。

gmksbk commented 1 year ago

确保退出登陆后然后重新登陆的状态下进入页面,如果还是没数据就进入chatgpt对话页面,F12然后在应用界面查看第一行session token,接着新开一条对话,然后接续查看token有无变化,刷新至session token出现变化后应该能够重新获取token

kwingart commented 1 year ago

我每次都是这么操作的,登录,退出。再登录,打开https://chat.openai.com/api/auth/session ,然后就出现上面的{},或者这个图里面的情况,没一次能获得新的token image

gmksbk commented 1 year ago

进入网页版chatgpt,然后按F12进入浏览器控制台,点击应用(app),查看一下第一行的session token数据,看的大概,然后退出控制台,新开对话页面,随便问个问题,刷新页面,再F12进入控制台,在应用栏查看session token是否有变化,没变化就重复操作。session token更新后access token刷新报错应该就会解决了

kwingart commented 1 year ago

image 看不到session token ,是我太菜了,不好意思。

kwingart commented 1 year ago

应该是这个了 image

kwingart commented 1 year ago

@gmksbk 按大神你的办法搞定了,谢谢!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 10 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 2 days since being marked as stale.