jackwuwei / gptspeaker

The ChatGPT Voice Assistant uses a Raspberry Pi (or desktop) to enable spoken conversation with OpenAI large language models. This implementation listens to speech, processes the conversation through the OpenAI service, and responds back. Like Apple Siri, Amazon Alex, Google Nest Home, Mi XiaoAi etc.
BSD 2-Clause "Simplified" License
41 stars 6 forks source link

Error communicating with OpenAI #3

Closed welkinchan closed 8 months ago

welkinchan commented 8 months ago

我在windows下,开了VPN之后,外网访问都正常,但是cmd运行后,一直提示无法访问openai

D:\code02\gpt_demo\00 gptspeaker-main>python gptspeaker.py OpenAI is listening. Say 'Hey GPT' to start. Say something starting with "Hey GPT" followed by whatever you want... RECOGNIZED KEYWORD: Hey GPT Recognized speech: 你知道苹果公司吗? [{'role': 'system', 'content': 'You are a friendly, intelligent, and curious assistant who is good at conversation.'}, {'role': 'user', 'content': '你知道苹果公司吗?'}] Encountered exception. Error communicating with OpenAI

jackwuwei commented 8 months ago

你能正常访问吗?https://api.openai.com/v1

welkinchan commented 8 months ago

你能正常访问吗?https://api.openai.com/v1

我已经解决了。我的VPN软件不知道啥原因,反正开全局的情况下,脚本无法收到openai的端口的返回数据。我在脚本里的openai接口函数里边配置了proxy之后就好了。

jackwuwei commented 8 months ago

你能正常访问吗?https://api.openai.com/v1

我已经解决了。我的VPN软件不知道啥原因,反正开全局的情况下,脚本无法收到openai的端口的返回数据。我在脚本里的openai接口函数里边配置了proxy之后就好了。

可以在亚洲其他国家搭建一个Nginx服务器,转发OpenAI的请求,在config.json里修改ApiBase,默认是https://api.openai.com/v1 改为自建的服务器地址即可,这样在国内的网络环境都能正常访问OpenAI API