From 5b7d613a35b15d7068404be5e712b11132829478 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Sat, 23 Aug 2025 23:25:19 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=98=BE=E7=A4=BA=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/plugins_func/functions/get_weather.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/xiaozhi-server/plugins_func/functions/get_weather.py b/main/xiaozhi-server/plugins_func/functions/get_weather.py index a3af6c03..38770a3f 100644 --- a/main/xiaozhi-server/plugins_func/functions/get_weather.py +++ b/main/xiaozhi-server/plugins_func/functions/get_weather.py @@ -110,6 +110,11 @@ WEATHER_CODE_MAP = { def fetch_city_info(location, api_key, api_host): url = f"https://{api_host}/geo/v2/city/lookup?key={api_key}&location={location}&lang=zh" response = requests.get(url, headers=HEADERS).json() + if response.get("error") is not None: + logger.bind(tag=TAG).error( + f"获取天气失败,原因:{response.get('error', {}).get('detail')}" + ) + return None return response.get("location", [])[0] if response.get("location") else None