diff --git a/common/time_check.py b/common/time_check.py index 56ea336..229dd14 100644 --- a/common/time_check.py +++ b/common/time_check.py @@ -5,11 +5,10 @@ from common.log import logger def time_checker(f): def _time_checker(self, *args, **kwargs): _config = config.conf() - chat_time_module = _config["chat_time_module"] - chat_start_time = _config["chat_start_time"] - chat_stopt_time = _config["chat_stop_time"] - + chat_time_module = _config.get("chat_time_module", False) if chat_time_module: + chat_start_time = _config.get("chat_start_time", "00:00") + chat_stopt_time = _config.get("chat_stop_time", "24:00") time_regex = re.compile(r'^([01]?[0-9]|2[0-4])(:)([0-5][0-9])$') #时间匹配,包含24:00 starttime_format_check = time_regex.match(chat_start_time) # 检查停止时间格式 diff --git a/config-template.json b/config-template.json index b6fdc97..902f290 100644 --- a/config-template.json +++ b/config-template.json @@ -1,4 +1,4 @@ - { +{ "open_ai_api_key": "YOUR API KEY", "model": "gpt-3.5-turbo", "proxy": "", @@ -11,9 +11,6 @@ "voice_reply_voice": false, "conversation_max_tokens": 1000, "expires_in_seconds": 3600, - "character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。", - "chat_time_module": false, - "chat_start_time": "00:00", - "chat_stop_time": "24:00" - } + "character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。" +}