mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-20 13:47:15 +08:00
fix: chat_time_module compatible logic
This commit is contained in:
@@ -5,11 +5,10 @@ from common.log import logger
|
|||||||
def time_checker(f):
|
def time_checker(f):
|
||||||
def _time_checker(self, *args, **kwargs):
|
def _time_checker(self, *args, **kwargs):
|
||||||
_config = config.conf()
|
_config = config.conf()
|
||||||
chat_time_module = _config["chat_time_module"]
|
chat_time_module = _config.get("chat_time_module", False)
|
||||||
chat_start_time = _config["chat_start_time"]
|
|
||||||
chat_stopt_time = _config["chat_stop_time"]
|
|
||||||
|
|
||||||
if chat_time_module:
|
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
|
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) # 检查停止时间格式
|
starttime_format_check = time_regex.match(chat_start_time) # 检查停止时间格式
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"open_ai_api_key": "YOUR API KEY",
|
"open_ai_api_key": "YOUR API KEY",
|
||||||
"model": "gpt-3.5-turbo",
|
"model": "gpt-3.5-turbo",
|
||||||
"proxy": "",
|
"proxy": "",
|
||||||
@@ -11,9 +11,6 @@
|
|||||||
"voice_reply_voice": false,
|
"voice_reply_voice": false,
|
||||||
"conversation_max_tokens": 1000,
|
"conversation_max_tokens": 1000,
|
||||||
"expires_in_seconds": 3600,
|
"expires_in_seconds": 3600,
|
||||||
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。",
|
"character_desc": "你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。"
|
||||||
"chat_time_module": false,
|
}
|
||||||
"chat_start_time": "00:00",
|
|
||||||
"chat_stop_time": "24:00"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user