Giter Site home page Giter Site logo

国内访问不行问题 about speechgpt HOT 9 OPEN

hahahumble avatar hahahumble commented on July 23, 2024
国内访问不行问题

from speechgpt.

Comments (9)

wsli001 avatar wsli001 commented on July 23, 2024

fork的另一个项目,部署到vercel再绑定自己的域名,国内就可以正常访问,请问有办法解决么,非常感谢

from speechgpt.

stevenlee87 avatar stevenlee87 commented on July 23, 2024

fork的另一个项目,部署到vercel再绑定自己的域名,国内就可以正常访问,请问有办法解决么,非常感谢

我也尝试用cname的方式做解析,国内虽然可以访问,但是没有梯子的话,还是无法正常的提问回答。

from speechgpt.

esroom avatar esroom commented on July 23, 2024

遇到同样的问题,解析域名后仍然要走代理才能用,同样的方法基于https://github.com/Chanzhaoyu/chatgpt-web 搭建的对话不需要代理,请问有什么办法吗?

from speechgpt.

hahahumble avatar hahahumble commented on July 23, 2024

目前请求是从客户端发出的,因此需要用代理才能正常使用,这可以通过自行部署的 OpenAI 地址解决,参考:noobnooc/noobnooc#9

此外,如果使用的是 speechgpt.app 官网,可以使用已经部署好的地址:https://github.com/hahahumble/worker-openai-proxy

image-ZoX6rP7U

在设置中填入地址之后,在内地不需要代理也可以正常使用。

from speechgpt.

erbanku avatar erbanku commented on July 23, 2024

You can solve this issue by creating your own API proxy service or using the API proxy below:

openai-api-proxy.erbanku.com

Rest assured. Even if you used the API proxy, I can't get your OpenAI API key. There is no nonsense involved – it follows a no-bullshit policy.

Proxy implemented code
const TELEGRAPH_URL = 'https://api.openai.com';

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  const url = new URL(request.url);
  const headers_Origin = request.headers.get("Access-Control-Allow-Origin") || "*"
  url.host = TELEGRAPH_URL.replace(/^https?:\/\//, '');
  const modifiedRequest = new Request(url.toString(), {
    headers: request.headers,
    method: request.method,
    body: request.body,
    redirect: 'follow'
  });
  const response = await fetch(modifiedRequest);
  const modifiedResponse = new Response(response.body, response);
  // Add a response header that allows cross-domain access
  modifiedResponse.headers.set('Access-Control-Allow-Origin', headers_Origin);
  return modifiedResponse;
}

from speechgpt.

Linaom1214 avatar Linaom1214 commented on July 23, 2024

目前请求是从客户端发出的,因此需要用代理才能正常使用,这可以通过自行部署的 OpenAI 地址解决,参考:noobnooc/noobnooc#9

此外,如果使用的是 speechgpt.app 官网,可以使用已经部署好的地址:https://github.com/hahahumble/worker-openai-proxy

image-ZoX6rP7U

在设置中填入地址之后,在内地不需要代理也可以正常使用。

自己部署的网页也可以使用 ‘api.speech.com’吗? 这里不太懂 vercel 本来就是免翻为什么还要代理?

from speechgpt.

erbanku avatar erbanku commented on July 23, 2024

目前请求是从客户端发出的,因此需要用代理才能正常使用,这可以通过自行部署的 OpenAI 地址解决,参考:noobnooc/noobnooc#9
此外,如果使用的是 speechgpt.app 官网,可以使用已经部署好的地址:hahahumble/worker-openai-proxy
image-ZoX6rP7U
在设置中填入地址之后,在内地不需要代理也可以正常使用。

自己部署的网页也可以使用 ‘api.speech.com’吗? 这里不太懂 vercel 本来就是免翻为什么还要代理?

是的,自己部署的也可以用该 Proxy URL.
要代理是因为请求不是通过 Vercel 发出的,而是通过用户客户端发出的。你可以在部署时通过环境变量配置 OpenAI API Host ,这样就不需要开代理或者在网页前端输入代理了。

from speechgpt.

esroom avatar esroom commented on July 23, 2024

目前请求是从客户端发出的,因此需要用代理才能正常使用,这可以通过自行部署的 OpenAI 地址解决,参考:noobnooc/noobnooc#9

此外,如果使用的是 speechgpt.app 官网,可以使用已经部署好的地址:https://github.com/hahahumble/worker-openai-proxy

image-ZoX6rP7U

在设置中填入地址之后,在内地不需要代理也可以正常使用。

十分感谢,用这个方法可以了!

from speechgpt.

xinlake avatar xinlake commented on July 23, 2024

有计划改为从服务端 OpenAI 向发起请求吗?客户端不与 OpenAI 直接通讯,这样不需要客户端走国际网络。

from speechgpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.