Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提示这个错误是不是没有走系统代理,我设置全局也是这个错误,是不是需要改动代码才能走代理呢? #22

Closed
joisonwk opened this issue Jul 8, 2023 · 2 comments

Comments

@joisonwk
Copy link

joisonwk commented Jul 8, 2023

python .\startup.py "Write a Snake Game"
2023-07-09 00:50:19.406 | INFO | metagpt.config:init:43 - Config loading done.
2023-07-09 00:50:19.408 | INFO | metagpt.config:init:49 - Set OPENAI_API_BASE in case of network issues
2023-07-09 00:50:21.142 | INFO | metagpt.software_company:invest:39 - Investment: $3.0.
2023-07-09 00:50:21.144 | INFO | metagpt.roles.role:_act:153 - Alice(Product Manager): ready to WritePRD
Traceback (most recent call last):
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 980, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 1056, in create_connection
raise exceptions[0]
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 1041, in create_connection
sock = await self._connect_sock(
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 955, in _connect_sock
await self.sock_connect(sock, address)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\proactor_events.py", line 702, in sock_connect
return await self._proactor.connect(sock, address)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\windows_events.py", line 812, in _poll
value = callback(transferred, key, ov)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\windows_events.py", line 599, in finish_connect
ov.getresult()
OSError: [WinError 121] 信号灯超时时间已到

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 668, in arequest_raw
result = await session.request(**request_kwargs)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\client.py", line 536, in _request
conn = await self._connector.connect(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 540, in connect
proto = await self._create_connection(req, traces, timeout)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 901, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 1206, in _create_direct_connection
raise last_exc
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\aiohttp\connector.py", line 988, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.openai.com:443 ssl:default [信号灯超时时间已到]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\GPT\MetaGPT\startup.py", line 29, in
fire.Fire(main)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 141, in Fire
component_trace = _Fire(component, args, parsed_flag_args, context, name)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 475, in _Fire
component, remaining_args = _CallAndUpdateTrace(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\fire\core.py", line 691, in _CallAndUpdateTrace
component = fn(*varargs, **kwargs)
File "D:\GPT\MetaGPT\startup.py", line 25, in main
asyncio.run(startup(idea, investment, n_round))
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "E:\programData\Anaconda3\envs\py3.9\lib\asyncio\base_events.py", line 642, in run_until_complete
return future.result()
File "D:\GPT\MetaGPT\startup.py", line 15, in startup
await company.run(n_round=n_round)
File "D:\GPT\MetaGPT\metagpt\software_company.py", line 60, in run
await self.environment.run()
File "D:\GPT\MetaGPT\metagpt\environment.py", line 58, in run
await asyncio.gather(*futures)
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 223, in run
rsp = await self._react()
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 194, in _react
return await self._act()
File "D:\GPT\MetaGPT\metagpt\roles\role.py", line 154, in _act
response = await self._rc.todo.run(self._rc.important_memory)
File "D:\GPT\MetaGPT\metagpt\actions\write_prd.py", line 69, in run
rsp = await sas.run(context=requirements, system_text=SEARCH_AND_SUMMARIZE_SYSTEM_EN_US)
File "D:\GPT\MetaGPT\metagpt\actions\search_and_summarize.py", line 135, in run
result = await self._aask(prompt, system_prompt)
File "D:\GPT\MetaGPT\metagpt\actions\action.py", line 41, in _aask
return await self.llm.aask(prompt, system_msgs)
File "D:\GPT\MetaGPT\metagpt\provider\base_gpt_api.py", line 44, in aask
rsp = await self.acompletion_text(message, stream=True)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 27, in wrapper
return await f(*args, **kwargs)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 213, in acompletion_text
return await self._achat_completion_stream(messages)
File "D:\GPT\MetaGPT\metagpt\provider\openai_api.py", line 146, in _achat_completion_stream
response = await openai.ChatCompletion.acreate(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_resources\chat_completion.py", line 45, in acreate
return await super().acreate(*args, **kwargs)
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 217, in acreate
response, _, api_key = await requestor.arequest(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 372, in arequest
result = await self.arequest_raw(
File "E:\programData\Anaconda3\envs\py3.9\lib\site-packages\openai\api_requestor.py", line 685, in arequest_raw
raise error.APIConnectionError("Error communicating with OpenAI") from e
openai.error.APIConnectionError: Error communicating with OpenAI

@geekan
Copy link
Owner

geekan commented Jul 9, 2023

参考 https://github.com/beidongjiedeguang/openai-forward 中转

考虑在key.yaml中设置 OPENAI_API_BASE: "https://api.openai-forward.com/v1"

风险:走第三方中转会有隐私泄露的风险,建议最好自己架设

@joisonwk
Copy link
Author

joisonwk commented Jul 9, 2023

改成 wsl2+ubuntu+v2rayA 代理正常了

@joisonwk joisonwk closed this as completed Jul 9, 2023
iorisa referenced this issue in iorisa/MetaGPT Sep 4, 2023
stellaHSR pushed a commit that referenced this issue Dec 4, 2023
feat: Merge geekan/MetaGPT/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants