问题一:
ERROR:root:No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details.
这个是因为没有设置OPENAI_API_KEY
# 注意:这里OPENAI_API_KEY不需要加引号!!!
set OPENAI_API_KEY=你的OPENAI_API_KEY
问题二:
ERROR - root - Error communicating with OpenAI
这个我也不知道什么原因 百度了好多就是说urllib3版本问题,但是我这边修改了还是不行。
应该是因为开代理了
# 更改urllib3版本
pip uninstall urllib3
pip install urllib3==1.25.11
# 127.0.0.1:7890 是我的代理IP
set HTTP_PROXY=http://127.0.0.1:7890
set HTTPS_PROXY=https://127.0.0.1:7890
问题三:
宝可梦的demo运行的时候说 uvicorn 命令不存在
# 加上 python -m 的前缀运行
python -m uvicorn pokemon_server:app --reload --port 10002