From 8b247054bb9aeef29a69390deb6583e5b429014f Mon Sep 17 00:00:00 2001 From: roeseth Date: Mon, 10 Mar 2025 19:07:45 -0700 Subject: [PATCH] update compose.yml to mount system time and tz --- compose.yml | 2 ++ packages/astrbot/main.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/compose.yml b/compose.yml index 75380370c..805d30c11 100644 --- a/compose.yml +++ b/compose.yml @@ -12,3 +12,5 @@ services: - "11451:11451" # optional, gewechat default port volumes: - ./data:/AstrBot/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro diff --git a/packages/astrbot/main.py b/packages/astrbot/main.py index 93e370e39..415e58f02 100644 --- a/packages/astrbot/main.py +++ b/packages/astrbot/main.py @@ -1098,8 +1098,9 @@ UID: {user_id} 此 ID 可用于设置管理员。 req.prompt = user_info + req.prompt if self.enable_datetime: + # Including timezone current_time = ( - datetime.datetime.now().astimezone().strftime("%Y-%m-%d %H:%M") + datetime.datetime.now().astimezone().strftime("%Y-%m-%d %H:%M (%Z)") ) req.system_prompt += f"\nCurrent datetime: {current_time}\n"