增加获取默认值,配置文件提示

This commit is contained in:
Sakura-RanChen
2025-05-14 17:17:03 +08:00
parent 7c63b7c062
commit 36109e3b88
2 changed files with 3 additions and 2 deletions
@@ -151,8 +151,8 @@ def parse_weather_info(soup):
@register_function("get_weather", GET_WEATHER_FUNCTION_DESC, ToolType.SYSTEM_CTL)
def get_weather(conn, location: str = None, lang: str = "zh_CN"):
api_host = conn.config["plugins"]["get_weather"]["api_host"]
api_key = conn.config["plugins"]["get_weather"]["api_key"]
api_host = conn.config["plugins"]["get_weather"].get("api_host", "mj7p3y7naa.re.qweatherapi.com")
api_key = conn.config["plugins"]["get_weather"].get("api_key", "a861d0d5e7bf4ee1a83d9a9e4f96d4da")
default_location = conn.config["plugins"]["get_weather"]["default_location"]
client_ip = conn.client_ip
# 优先使用用户提供的location参数