maxduke / go-chatgpt-api

一个尝试绕过 Cloudflare 来使用 ChatGPT 接口的程序
MIT License
144 stars 35 forks source link

bad response status code 422 #66

Closed catsimple closed 4 months ago

catsimple commented 4 months ago

用access token的方式登录,免费账户,请求4o或者3.5turbo都是报的422 ip应该是好的,能用浏览器访问官网对话

{
  "error": {
    "message": "bad response status code 422 (request id: 2024052717310258767663905166404)",
    "type": "upstream_error",
    "param": "422",
    "code": "bad_response_status_code"
  }
}

日志没看出什么

stderr: Error: please put HAR files in harPool directory!
stderr: [36mINFO[0m[0000] [1;32mPROXY: socks5://192.168.10.1:30083[0m 
stderr: [36mINFO[0m[0000] [1;32mHealth Check is disabled[0m          
stderr: [36mINFO[0m[0015] [1;32mPOW Difficulty: 000032 , took 5017 ms[0m 
stdout: [GIN] 2024/05/27 - 17:30:36 |[90;43m 422 [0m|  6.826894455s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions"
stderr: [36mINFO[0m[0043] [1;32mPOW Difficulty: 000032 , took 831 ms[0m 
stdout: [GIN] 2024/05/27 - 17:31:04 |[90;43m 422 [0m|   2.37061207s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions?path=v1&path=chat&path=completions"
stderr: [36mINFO[0m[0046] [1;32mPOW Difficulty: 0002bc , took 1024 ms[0m 
stdout: [GIN] 2024/05/27 - 17:31:07 |[90;43m 422 [0m|  2.406341973s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions?path=v1&path=chat&path=completions"
stderr: [36mINFO[0m[0327] [1;32mPOW Difficulty: 000032 , took 10282 ms[0m 
stdout: [GIN] 2024/05/27 - 17:35:48 |[90;43m 422 [0m| 11.883638128s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions?path=v1&path=chat&path=completions"
maxduke commented 4 months ago

har文件要配置,建议看下文档 https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md#har%E6%96%87%E4%BB%B6%E6%B1%A0

catsimple commented 4 months ago

har文件要配置,建议看下文档 https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md#har%E6%96%87%E4%BB%B6%E6%B1%A0

之前一直都是没有配置har文件都能用的,刚刚配置了har文件,还是报422

stderr: [36mINFO[0m[0000] [1;32mPROXY: socks5://192.168.10.1:30083[0m 
stderr: [36mINFO[0m[0000] [1;32mHealth Check is disabled[0m          
stderr: [36mINFO[0m[0098] [1;32mPOW Difficulty: 0002bc , took 732 ms[0m 
stdout: [GIN] 2024/05/27 - 19:00:03 |[90;43m 422 [0m|  2.467107236s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions"
stderr: [36mINFO[0m[0129] [1;32mPOW Difficulty: 000032 , took 5582 ms[0m 
stdout: [GIN] 2024/05/27 - 19:00:33 |[90;43m 422 [0m|  7.063095743s |    192.168.21.8 |[97;46m POST    [0m "/imitate/v1/chat/completions"
maxduke commented 4 months ago

那就要看看是不是IP黑了 官网出盾么?

On Mon, May 27, 2024 at 19:01 catsimple @.***> wrote:

har文件要配置,建议看下文档 https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md#har%E6%96%87%E4%BB%B6%E6%B1%A0

之前一直都是没有配置har文件都能用的,刚刚配置了har文件,还是报422

stderr: [36mINFO[0m[0000] [1;32mPROXY: socks5://192.168.10.1:30083[0m stderr: [36mINFO[0m[0000] [1;32mHealth Check is disabled[0m stderr: [36mINFO[0m[0098] [1;32mPOW Difficulty: 0002bc , took 732 ms[0m stdout: [GIN] 2024/05/27 - 19:00:03 |[90;43m 422 [0m| 2.467107236s | 192.168.21.8 |[97;46m POST [0m "/imitate/v1/chat/completions" stderr: [36mINFO[0m[0129] [1;32mPOW Difficulty: 000032 , took 5582 ms[0m stdout: [GIN] 2024/05/27 - 19:00:33 |[90;43m 422 [0m| 7.063095743s | 192.168.21.8 |[97;46m POST [0m "/imitate/v1/chat/completions"

— Reply to this email directly, view it on GitHub https://github.com/maxduke/go-chatgpt-api/issues/66#issuecomment-2133232136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLUBD7V4UQRDESP2YQKKDZEMHCJAVCNFSM6AAAAABIK25W4KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZTGIZTEMJTGY . You are receiving this because you commented.Message ID: @.***>

catsimple commented 4 months ago

那就要看看是不是IP黑了 官网出盾么? On Mon, May 27, 2024 at 19:01 catsimple @.> wrote: har文件要配置,建议看下文档 https://github.com/xqdoo00o/ChatGPT-to-API/blob/master/README_ZH.md#har%E6%96%87%E4%BB%B6%E6%B1%A0 之前一直都是没有配置har文件都能用的,刚刚配置了har文件,还是报422 stderr: [36mINFO[0m[0000] [1;32mPROXY: socks5://192.168.10.1:30083[0m stderr: [36mINFO[0m[0000] [1;32mHealth Check is disabled[0m stderr: [36mINFO[0m[0098] [1;32mPOW Difficulty: 0002bc , took 732 ms[0m stdout: [GIN] 2024/05/27 - 19:00:03 |[90;43m 422 [0m| 2.467107236s | 192.168.21.8 |[97;46m POST [0m "/imitate/v1/chat/completions" stderr: [36mINFO[0m[0129] [1;32mPOW Difficulty: 000032 , took 5582 ms[0m stdout: [GIN] 2024/05/27 - 19:00:33 |[90;43m 422 [0m| 7.063095743s | 192.168.21.8 |[97;46m POST [0m "/imitate/v1/chat/completions" — Reply to this email directly, view it on GitHub <#66 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLUBD7V4UQRDESP2YQKKDZEMHCJAVCNFSM6AAAAABIK25W4KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZTGIZTEMJTGY . You are receiving this because you commented.Message ID: @.>

好吧,有cf验证,估计是这个问题了

King-Of-Knights commented 4 months ago

@maxduke 佬,能帮忙看看这个问题嘛?

Exception: 422 Unprocessable Entity {"detail":[{"ctx":{"given":"","permitted":["primary_assistant"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'primary_assistant'","type":"value_error.const"},{"ctx":{"given":"","permitted":["business_template"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'business_template'","type":"value_error.const"},{"loc":["body","conversation_mode","template_id"],"msg":"field required","type":"value_error.missing"},{"ctx":{"given":"","permitted":["business_template_playground"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'business_template_playground'","type":"value_error.const"},{"loc":["body","conversation_mode","config"],"msg":"field required","type":"value_error.missing"},{"ctx":{"given":"","permitted":["gizmo_interaction"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'gizmo_interaction'","type":"value_error.const"},{"loc":["body","conversation_mode","gizmo_id"],"msg":"field required","type":"value_error.missing"},{"ctx":{"given":"","permitted":["gizmo_magic_create"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'gizmo_magic_create'","type":"value_error.const"},{"loc":["body","conversation_mode","behavior_overrides"],"msg":"field required","type":"value_error.missing"},{"ctx":{"given":"","permitted":["gizmo_test"]},"loc":["body","conversation_mode","kind"],"msg":"unexpected value; permitted: 'gizmo_test'","type":"value_error.const"}]}

maxduke commented 4 months ago

最新代码应该修复了imitate接口422错误的问题,拉下看看

King-Of-Knights commented 4 months ago

@maxduke 解决了!

catsimple commented 4 months ago

@maxduke 解决了