maxduke / go-chatgpt-api

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

如何只做api转发 #71

Closed Garbo1229 closed 1 month ago

Garbo1229 commented 1 month ago

环境:干净ip 网页可用 账号:免费账号 服务端:

services:
  go-chatgpt-api:
    container_name: go-chatgpt-api
    image: maxduke/go-chatgpt-api
    ports:
      - 8080:8080
    environment:
      - TZ=Asia/Shanghai
      - UA=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
    volumes:
      - ./harPool:/app/harPool
    restart: unless-stopped

客户端: chatgpt-web

尝试过导出har放入文件夹中 也没有成功部署

修改了API_REVERSE_PROXYOPENAI_ACCESS_TOKEN 其中API_REVERSE_PROXY尝试过/imitate/v1/chat/completions/chatgpt/backend-api/conversation会得到400和422结果 结果如下

ChatGPT error 422: {"detail":[{"type":"union_tag_invalid","loc":["body","conversation_mode"],"msg":"Input tag '' found using 'kind' does not match any of the expected tags: 'primary_assistant', 'business_template', 'business_template_playground', 'gizmo_interaction', 'gizmo_magic_create', 'gizmo_test'","input":{"kind":""},"ctx":{"discriminator":"'kind'","tag":"","expected_tags":"'primary_assistant', 'business_template', 'business_template_playground', 'gizmo_interaction', 'gizmo_magic_create', 'gizmo_test'"}}]}
ChatGPT error 400: {"error":{"code":"json: cannot unmarshal object into Go struct field ApiMessage.messages.content of type string","message":"Request must be proper JSON","param":null,"type":"invalid_request_error"}}

我的目的是希望在chatgpt-web放token然后用这个项目做转发 仅api不使用cws 我是需要怎么修改才可用

maxduke commented 1 month ago

首先你先确定你到底是单纯想逆向转发还是chat2api,其次发各种情况的后端log

Garbo1229 commented 1 month ago

首先你先确定你到底是单纯想逆向转发还是chat2api,其次发各种情况的后端log

应该是转发 我之前大概年初用过这个 没问题 但后面更新了几次 出现了一些变化我没有跟上可能不会用了 当时是chatgpt-web配置token后发消息 然后go-chatgpt-api配合chatgpt-proxy-server-warp完成的 虽然ip干净 当时也用了chatgpt-proxy-server-warp

关于log 大概是这样的情况(配置了harPool) 请指点

 ✔ Network chatgpt-api_default  Created                                                                                                                                         0.1s 
 ✔ Container go-chatgpt-api     Created                                                                                                                                         0.2s 
Attaching to go-chatgpt-api
go-chatgpt-api  | INFO[0000] Health Check is disabled          
go-chatgpt-api  | [GIN] 2024/07/14 - 15:40:58 | 400 |     524.128µs |    | POST     "/imitate/v1/chat/completions"
go-chatgpt-api  | INFO[0098] POW Difficulty: 002bb4 , took 8 ms 
go-chatgpt-api  | [GIN] 2024/07/14 - 15:41:25 | 422 |  398.143967ms |    | POST     "/chatgpt/backend-api/conversation"
maxduke commented 1 month ago

用的什么模型?

Garbo1229 commented 1 month ago

用的什么模型?

chatgpt-web 没有配置 按文档默认gpt-3.5-turbo

服务端配置全部

services:
  go-chatgpt-api:
    container_name: go-chatgpt-api
    image: maxduke/go-chatgpt-api
    ports:
      - 8080:8080
    environment:
      - TZ=Asia/Shanghai
      - UA=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
    volumes:
      - ./harPool:/app/harPool
    restart: unless-stopped
maxduke commented 1 month ago

逆向的3.5用 text-davinci-002-render-sha 有4的用 gpt-4 gpt-4-o

话说已经不推荐用那个前端了

On Sun, Jul 14, 2024 at 20:34 Garbo @.***> wrote:

用的什么模型?

chatgpt-web 没有配置 按文档默认gpt-3.5-turbo

服务端配置全部

services: go-chatgpt-api: container_name: go-chatgpt-api image: maxduke/go-chatgpt-api ports:

  • 8080:8080 environment:
  • TZ=Asia/Shanghai
  • UA=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 volumes:
  • ./harPool:/app/harPool restart: unless-stopped

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

Garbo1229 commented 1 month ago

逆向的3.5用 text-davinci-002-render-sha 有4的用 gpt-4 gpt-4-o 话说已经不推荐用那个前端了 On Sun, Jul 14, 2024 at 20:34 Garbo @.> wrote: 用的什么模型? chatgpt-web 没有配置 按文档默认gpt-3.5-turbo 服务端配置全部 services: go-chatgpt-api: container_name: go-chatgpt-api image: maxduke/go-chatgpt-api ports: - 8080:8080 environment: - TZ=Asia/Shanghai - UA=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 volumes: - ./harPool:/app/harPool restart: unless-stopped — Reply to this email directly, view it on GitHub <#71 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLUBDVVLXUBB22USGVVFDZMJV5TAVCNFSM6AAAAABK26OT5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGMZTENBSGM . You are receiving this because you commented.Message ID: @.>

有个问题是我尝试修改OPENAI_API_MODEL=gpt-4o 好像也不行 现在都推荐用cws么 主要我的想法是最好是直接转发这样简单点 但好想没办法直接对接

maxduke commented 1 month ago

那个前端我1年前用过,后来作者主攻收费版了。我只用CWS。CWS也是直接转发呀

Garbo1229 commented 1 month ago

那个前端我1年前用过,后来作者主攻收费版了。我只用CWS。CWS也是直接转发呀

行吧 那我也用cws吧 之前布置过一次 可以使用但不知道为啥会出现这个前端无法对接的问题 我感觉可能是前端对接问题导致的 现在chatgpt-api还可以配合老的chatgpt-proxy-server-warp使用么

maxduke commented 1 month ago

我不用,具体不清楚。ip干净的话还是推荐直接上

On Sun, Jul 14, 2024 at 21:01 Garbo @.***> wrote:

那个前端我1年前用过,后来作者主攻收费版了。我只用CWS。CWS也是直接转发呀

行吧 那我也用cws吧 之前布置过一次 可以使用但不知道为啥会出现这个前端无法对接的问题 我感觉可能是前端对接问题导致的 现在chatgpt-api还可以配合老的chatgpt-proxy-server-warp使用么

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

Garbo1229 commented 1 month ago

我不用,具体不清楚。ip干净的话还是推荐直接上 On Sun, Jul 14, 2024 at 21:01 Garbo @.> wrote: 那个前端我1年前用过,后来作者主攻收费版了。我只用CWS。CWS也是直接转发呀 行吧 那我也用cws吧 之前布置过一次 可以使用但不知道为啥会出现这个前端无法对接的问题 我感觉可能是前端对接问题导致的 现在chatgpt-api还可以配合老的chatgpt-proxy-server-warp使用么 — Reply to this email directly, view it on GitHub <#71 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLUBBYR4GCKFCMVCUAEXLZMJZB5AVCNFSM6AAAAABK26OT5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGM2DAOBZGI . You are receiving this because you commented.Message ID: @.>

好的 感谢