ChatGPTNextWeb / ChatGPTNextWeb/NextChat
为什么cloudflare配置Gemini的代理用不了
- Dominant language
- TypeScript
- Stars
- 88.8k
- Forks
- 59.1k
- PR merge metrics
- No merged PRs in 30d
Description
const TELEGRAPH_URL = 'https://generativelanguage.googleapis.com/';
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url);
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);
// 添加允许跨域访问的响应头
modifiedResponse.headers.set('Access-Control-Allow-Origin', '*');
return modifiedResponse;
}
我把openai的网址换成Gemini的为啥用不了,填openAI的网址国内可以访问。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.