Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 请求出错 #106

Open
CR23-Yzlong opened this issue Dec 12, 2023 · 6 comments
Open

API 请求出错 #106

CR23-Yzlong opened this issue Dec 12, 2023 · 6 comments

Comments

@CR23-Yzlong
Copy link

api 地址填的是这个 http://192.168.0.58:7860/api/v1/chat/completions

页面可用, API 不可用

图片

下边是报错信息

图片

不携带 cookie 请求 api

图片

这个是携带 cookie 请求 API

图片

@CR23-Yzlong
Copy link
Author

搜代码找到了这个异常
图片

@CR23-Yzlong
Copy link
Author

docker-compose 信息

version: '3.5'

services:
  bingo:
    image: weaigc/bingo
    container_name: bingo
    ports:
      - "7860:7860"
    environment:
       - BING_HEADER=""
       - HTTP_PROXY=http://192.168.0.58:9999
       - HTPPS_PROXY=http://192.168.0.58:9999

@CR23-Yzlong
Copy link
Author

我直接用库里的代码也不行

import openai
openai.api_key = ""
openai.api_base = "http://192.168.0.58:7860" # 这里可以改为你自己部署的服务,bingo 服务版本需要 >= 0.9.0

# create a chat completion
completion = openai.ChatCompletion.create(model="gpt-4", stream=False, messages=[{"role": "user", "content": "Hello"}])
print(completion.choices[0].message.content)
    raise error.APIError(
openai.error.APIError: HTTP code 200 from API (data: {"choices":[{"delta":{"role":"assistant","content":"Error: 你的 VPS 或代理可能被封禁,如有疑问,请前往 https://github.com/weaigc/bingo 咨询"},"message":{"role":"assistant的 VPS 或代理可能被封禁,如有疑问,请前往 https://github.com/weaigc/bingo 咨询"}}]}

{"choices":[{"delta":{"role":"assistant","content":""},"message":{"role":"assistant","content":""}}]})

@SokWith
Copy link

SokWith commented Dec 14, 2023

#78 (comment)

@CR23-Yzlong
Copy link
Author

CR23-Yzlong commented Dec 15, 2023

#78 (comment)

这就是我不太理解的地方, 比如代理服务器 server_1, IP 是22.x.x.x 我本地代理转发是 192.168.0.58

我直接在22.X 上边部署 docker API 是可用的,

但是我在58上部署docker ,设置代理为 22.x 就不行

@jerryliang122
Copy link

我想问问。我在docker compose 里设置了 BING_HEADER,为什么API 也无法使用?API是不是只支持匿名访问。不支持带用户数据来访问吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants