lich0821 / WeChatRobot

微信机器人,接入Gemini、ChatGPT、ChatGLM、讯飞星火、Tigerbot;成语接龙、天气预报、新闻摘要、定时任务。
MIT License
1.35k stars 264 forks source link

[🐛BUG] 用一句话描述您的问题。 #38

Closed 165056821 closed 11 months ago

165056821 commented 11 months ago

使用环境(请补全下列信息):

描述这个 bug google gemini的API接口调用失败

Traceback (most recent call last): File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 79, in error_remappedcallable return callable(*args, **kwargs) File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\grpc_channel.py", line 1160, in call return _end_unary_response_blocking(state, call, False, None) File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\grpc_channel.py", line 1003, in _end_unary_response_blocking raise _InactiveRpcError(state) # pytype: disable=not-instantiable grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNAVAILABLE details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.160.106:443: socket is null" debug_error_string = "UNKNOWN:Error received from peer {created_time:"2023-12-16T00:55:14.7024441+00:00", grpc_status:14, grpc_message:"failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.160.106:443: socket is null"}"

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

Traceback (most recent call last): File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\retry.py", line 207, in retry_target result = target() File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\timeout.py", line 120, in func_with_timeout return func(*args, **kwargs) File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 81, in error_remapped_callable raise exceptions.from_grpc_error(exc) from exc google.api_core.exceptions.ServiceUnavailable: 503 failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.160.106:443: socket is null

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

Traceback (most recent call last): File "D:\Python\wechat\new\WeChatRobot\test_gemini.py", line 9, in response = model.generate_content("The opposite of hot is") File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\generativeai\generative_models.py", line 243, in generate_content response = self._client.generate_content(request) File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\ai\generativelanguage_v1beta\services\generative_service\client.py", line 566, in generate_content response = rpc( File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\gapic_v1\method.py", line 131, in call return wrapped_func(*args, **kwargs) File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\retry.py", line 372, in retry_wrapped_func return retry_target( File "D:\Python\wechat\new\WeChatRobot\venv\lib\site-packages\google\api_core\retry.py", line 226, in retry_target raise exceptions.RetryError( google.api_core.exceptions.RetryError: Deadline of 60.0s exceeded while calling target function, last exception: 503 failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.160.106:443: socket is null

lich0821 commented 11 months ago

@aki66938 老板,有人来报 BUG 了——虽然很明显那是他网络的问题。

aki66938 commented 11 months ago

请问这是添加了socket代理吗?如果是的话,代理的方式暂不可用,建议本地全局。官方sdk未给出代理的方式,目前还在验证代理方案的可行性。如果验证完成,会提交新版本,敬请留意

suhou commented 11 months ago

问题一:按照最新更新的代理配置,我已经输入了key,机器人却只能回复我“你@我干嘛”。 问题二:我下载项目的源码,配置好以后,base文件夹里面的bard.py会报错,说找不到configuration,是不是因为configuration.py不在base文件里面呀

aki66938 commented 11 months ago

修复了proxy为空会无法启动bard的bug,请试用新版本

suhou commented 11 months ago

所有的源码都是最新的了,然后我配置好了bard的key,proxy,model,prompt,我在config.yaml文件把其他模型都注释了,只留下bard部分,但是运行main以后我问他问题还是无法回复,过一分钟后python返回Receiving message error: Deadline of 60.0s exceeded while calling target function, last exception: 503 failed to connect to all addresses; last error: UNKNOWN: ipv4:172.217.160.106:443: socket is null

aki66938 commented 11 months ago

503是客户端问题,报错提示了未知ip->172.217.160.106:443: socket is null。这个IP大概率是谷歌IP的或者是其前置服务端的IP(推测 因此,尝试一下其他连接方式吧,更换节点或者尝试全局。