From 1434ecbc2e430aa619fe6eb5b56e8161c6bf7148 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Thu, 27 Mar 2025 01:03:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=87=BD=E6=95=B0=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E6=97=B6=E6=9C=89=E6=97=B6=E5=8F=82=E6=95=B0=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/plugins_func/functions/get_time.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/plugins_func/functions/get_time.py b/main/xiaozhi-server/plugins_func/functions/get_time.py index 3eb7324c..2fb4f975 100644 --- a/main/xiaozhi-server/plugins_func/functions/get_time.py +++ b/main/xiaozhi-server/plugins_func/functions/get_time.py @@ -46,7 +46,7 @@ get_lunar_function_desc = { } } @register_function('get_lunar', get_lunar_function_desc, ToolType.WAIT) -def get_lunar(query): +def get_lunar(query=None): """ 用于获取当前的阴历/农历,和天干地支、节气、生肖、星座、八字、宜忌等黄历信息 """ @@ -54,6 +54,10 @@ def get_lunar(query): current_time = now.strftime("%H:%M:%S") current_date = now.strftime("%Y-%m-%d") current_weekday = now.strftime("%A") + + # 如果 query 为 None,则使用默认文本 + if query is None: + query = "默认查询干支年和农历日期" response_text = f"根据以下信息回应用户的查询请求,并提供与{query}相关的信息:\n" lunar = cnlunar.Lunar(now, godType='8char')