chatpire / chatgpt-web-share

ChatGPT Plus 共享方案。ChatGPT Plus / OpenAI API sharing solution.
https://cws-docs.pages.dev/zh/
GNU General Public License v3.0
4.3k stars 680 forks source link

新对话发消息后报错OpenaiWebException: [400] errors.openaiWeb {"code":400,"msg":"HTTP status client error (403 Forbidden) for url (https://chat.openai.com/backend-api/models)"} #371

Closed Longwt123 closed 9 months ago

Longwt123 commented 9 months ago

Version v0.x.x

What's your deploying environment?

Describe the problem 新对话发消息后报错,像是账号问题或ninja问题。 请问如何测试我的配置是否正确或验证ninja?

Your config.yaml or other configurations 填写了accessToken,但api-key不知道是openai网站个人信息那个还是要买那个没有填 格式是accessToken:“xxx”

Screenshots or running logs 前端弹出错误提示框 OpenAI 请求错误 (400 错误),请联系管理员处理 OpenaiWebException: [400] errors.openaiWeb {"code":400,"msg":"HTTP status client error (403 Forbidden) for url (https://ch***)"} 后端查看docker的log 2024/02/05 17:26:14.744 INFO: [uvicorn.error] connection open 2024/02/05 17:26:14.749 INFO: [cws.api.routers.chat] admin connected to websocket 2024/02/05 17:26:14.883 ERROR: [cws.api.routers.chat] OpenaiWebException: [400] errors.openaiWeb {"code":400,"msg":"HTTP status client error (403 Forbidden) for url (https://chat.openai.com/backend-api/models)"} 2024/02/05 17:26:14.926 INFO: [uvicorn.error] connection closed 2024/02/05 17:26:15.012 INFO: [cws.access] 120.84.10.248:0 | GET /user/me HTTP/1.1 | 200 OK | 23 ms

moeakwak commented 9 months ago

检查 ninja 的容器日志

Longwt123 commented 9 months ago

ninja容器的docker logs如下,似乎是404和400错误,但不知道为什么

2024-02-05T06:20:33.650310Z INFO request{method=GET uri=/ version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T06:20:33.650350Z INFO request{method=GET uri=/ version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=404 2024-02-05T06:28:31.053573Z INFO request{method=GET uri=/ version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T06:28:31.053613Z INFO request{method=GET uri=/ version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=404 2024-02-05T06:33:06.955584Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T07:33:07.075161Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T08:33:06.770513Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T09:26:14.821404Z INFO request{method=POST uri=/backend-api/conversation version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T09:26:14.881294Z INFO request{method=POST uri=/backend-api/conversation version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=59 ms status=400 2024-02-05T09:33:06.737200Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T10:33:06.757966Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T11:33:06.754673Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T12:33:06.741725Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T13:33:06.781530Z INFO openai::context::arkose: Arkose version: 2.3.5 2024-02-05T14:00:42.971625Z INFO request{method=GET uri=/har/upload version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:00:42.971703Z INFO request{method=GET uri=/har/upload version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=200 2024-02-05T14:00:43.111501Z INFO request{method=GET uri=/resources/jquery.min.js version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:00:43.111546Z INFO request{method=GET uri=/resources/jquery.min.js version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=404 2024-02-05T14:00:43.291528Z INFO request{method=GET uri=/har/list version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:00:43.292012Z INFO request{method=GET uri=/har/list version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=200 2024-02-05T14:00:46.400298Z INFO request{method=GET uri=/har/list version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:00:46.400549Z INFO request{method=GET uri=/har/list version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=0 ms status=200 2024-02-05T14:00:55.399677Z INFO request{method=POST uri=/har/upload version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:00:57.382251Z INFO request{method=POST uri=/har/upload version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=1982 ms status=200 2024-02-05T14:00:59.689150Z INFO openai::context::arkose::har: HAR directory: /root/.ninja/gpt4 changes observed: /root/.ninja/gpt4/chat.openai.com.har 2024-02-05T14:06:22.636898Z INFO request{method=POST uri=/backend-api/conversation version=HTTP/1.1}: tower_http::trace::on_request: started processing request 2024-02-05T14:06:22.704693Z INFO request{method=POST uri=/backend-api/conversation version=HTTP/1.1}: tower_http::trace::on_response: finished processing request latency=67 ms status=400

Longwt123 commented 9 months ago

我也用以下命令测试了key好像没问题 curl --http1.1 https://api.openai.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Say this is a test!"}] }'

accesstoken新获取的应该也没问题

ninja需要的Har也上传了(文件chat.openai.com.har)

moeakwak commented 9 months ago

确保更新到最新版本,access token也是最新的。如果稳定触发的话,请去ninja那里提问