mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-30 05:13:59 +08:00
增加获取默认值,配置文件提示
This commit is contained in:
@@ -101,6 +101,7 @@ plugins:
|
|||||||
# 这个密钥是项目共用的key,用多了可能会被限制
|
# 这个密钥是项目共用的key,用多了可能会被限制
|
||||||
# 想稳定一点就自行申请替换,每天有1000次免费调用
|
# 想稳定一点就自行申请替换,每天有1000次免费调用
|
||||||
# 申请地址:https://console.qweather.com/#/apps/create-key/over
|
# 申请地址:https://console.qweather.com/#/apps/create-key/over
|
||||||
|
# 申请后通过这个链接可以找到自己的apihost:https://console.qweather.com/setting?lang=zh
|
||||||
get_weather: {"api_host":"mj7p3y7naa.re.qweatherapi.com", "api_key": "a861d0d5e7bf4ee1a83d9a9e4f96d4da", "default_location": "广州" }
|
get_weather: {"api_host":"mj7p3y7naa.re.qweatherapi.com", "api_key": "a861d0d5e7bf4ee1a83d9a9e4f96d4da", "default_location": "广州" }
|
||||||
# 获取新闻插件的配置,这里根据需要的新闻类型传入对应的url链接,默认支持社会、科技、财经新闻
|
# 获取新闻插件的配置,这里根据需要的新闻类型传入对应的url链接,默认支持社会、科技、财经新闻
|
||||||
# 更多类型的新闻列表查看 https://www.chinanews.com.cn/rss/
|
# 更多类型的新闻列表查看 https://www.chinanews.com.cn/rss/
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ def parse_weather_info(soup):
|
|||||||
|
|
||||||
@register_function("get_weather", GET_WEATHER_FUNCTION_DESC, ToolType.SYSTEM_CTL)
|
@register_function("get_weather", GET_WEATHER_FUNCTION_DESC, ToolType.SYSTEM_CTL)
|
||||||
def get_weather(conn, location: str = None, lang: str = "zh_CN"):
|
def get_weather(conn, location: str = None, lang: str = "zh_CN"):
|
||||||
api_host = conn.config["plugins"]["get_weather"]["api_host"]
|
api_host = conn.config["plugins"]["get_weather"].get("api_host", "mj7p3y7naa.re.qweatherapi.com")
|
||||||
api_key = conn.config["plugins"]["get_weather"]["api_key"]
|
api_key = conn.config["plugins"]["get_weather"].get("api_key", "a861d0d5e7bf4ee1a83d9a9e4f96d4da")
|
||||||
default_location = conn.config["plugins"]["get_weather"]["default_location"]
|
default_location = conn.config["plugins"]["get_weather"]["default_location"]
|
||||||
client_ip = conn.client_ip
|
client_ip = conn.client_ip
|
||||||
# 优先使用用户提供的location参数
|
# 优先使用用户提供的location参数
|
||||||
|
|||||||
Reference in New Issue
Block a user