Open cailei0596 opened 1 year ago
The network request is initiated in the node layer and not in the browser, make sure you have a proxy enabled for node? (e.g. TUN mode for proxy software, or enable terminal proxy).
One way to verify this is to run ping api.openai.com
in the terminal to see if the proxy is set up correctly.
I have encountered the same problem when deploying with Docker ,"fetch failed",I know it’s probably because of proxy. my trojan config.json on my server like this:
"run_type": "client",
"local_addr": "0.0.0.0",
"local_port": 1080,
"remote_addr": "61.172.229.205",
"remote_port": 28101,
"password": [
"edfdfaad"
]
my docker-compose.yml like this:
version: '3'
services:
chatgpt-demo:
image: ddiu8081/chatgpt-demo:latest
container_name: chatgpt-demo
restart: always
ports:
- '8000:3000'
environment:
- OPENAI_API_KEY=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
- HTTP_PROXY=http://127.0.0.1:1080
I use proxychains
when I run proxychains ping api.openai.com
in the terminal ,I get wrong response.But in my other app on my server, I can use openai api normally and proxychains curl api.openai.com
command also gets right response .Anithing wrong in my config.json or docker-compose.yml ?
Every thing is fine when running this project on my Mac with Docker Desktop,while on my CentOS server is invalid.Please give me some advice,thanks so much ! @ddiu8081
遇到了同样的问题 ,无法解决
@cailei0596 @ladypiapia @xyxbc-git
If you are running the app on your host machine, try using the curl command to access api.open.com and ensure that the network is functioning properly.
If you are running the app on Docker, make sure to configure the proxy settings for Docker. Login to docker and curl api.open.com make sure your setting is correct.
I can ping the api.openai.com well. But still got this error, any thoughts or solutions?
Replace
cdn: 'https://esm.sh/',
in unocss.config.ts
with
cdn: 'http://esm.sh/',
can solve this error in my case.
ubuntu22
leo@leo-virtual-machine:~/chatgpt-demo$ node -v v20.0.0 leo@leo-virtual-machine:~/chatgpt-demo$ npm -v 9.6.4
确认不是网络问题,用代理和不用代理都试过了
chatgpt-api-demo@0.0.1 dev /home/leo/chatgpt-demo
🚀 astro v2.1.3 started in 429ms
┃ Local http://localhost:3000/ ┃ Network use --host to expose
fetch failed (https://esm.sh/@iconify-json/ph/icons.json) error fetch failed (https://esm.sh/@iconify-json/ph/icons.json) File: /home/leo/chatgpt-demo/node_modules/.pnpm/ofetch@1.0.1/node_modules/ofetch/dist/shared/ofetch.f223b849.cjs:182:24 Code: 181 | }
error fetch failed (https://esm.sh/@iconify-json/ph/icons.json) File: /home/leo/chatgpt-demo/node_modules/.pnpm/ofetch@1.0.1/node_modules/ofetch/dist/shared/ofetch.f223b849.cjs:182:24 Code: 181 | }