- 增加GPT提示语

- 简化提示
This commit is contained in:
yshtcn 2023-09-25 17:13:54 +08:00
parent d6240f63e2
commit d408d78303

View File

@ -53,17 +53,18 @@ def set_bot_commands():
try: try:
set_commands_url = URL + "setMyCommands" set_commands_url = URL + "setMyCommands"
commands = [ commands = [
{"command": "start", "description": "首次使用向导/显示帮助。"}, {"command": "/start", "description": "首次使用"},
{"command": "done", "description": "结束记录:发送并开始新的记录。"}, {"command": "/tips", "description": "GPT提示语"},
{"command": "check", "description": "检查记录,已有记录。"}, {"command": "/done", "description": "结束记录"},
{"command": "removelast", "description": "删除最后一条记录。"} {"command": "/check", "description": "检查记录"},
{"command": "/removelast", "description": "删除最后记录"}
] ]
response = requests.post(set_commands_url, json={"commands": commands}, proxies=proxies) response = requests.post(set_commands_url, json={"commands": commands}, proxies=proxies)
response.raise_for_status() # 如果响应状态码不是200引发HTTPError异常 response.raise_for_status() # 如果响应状态码不是200引发HTTPError异常
return response.json() return response.json()
except requests.HTTPError as http_err: except requests.HTTPError as http_err:
return f"HTTP error occurred: {http_err}" return f"HTTP error occurred: {http_err} - {response.text}"
except Exception as err: except Exception as err:
return f"An error occurred: {err}" return f"An error occurred: {err}"
@ -186,7 +187,11 @@ def main():
# 处理特殊命令 # 处理特殊命令
if message_text.lower() == "/start": if message_text.lower() == "/start":
send_message(chat_id_str, f"#使用帮助\n欢迎使日记助手,你可以直接开始发送要记录的内容.随时可以发送: \n/check 查看已记录的内容,并继续记录。\n /done 记录完毕,把记录发送给您,并开启新的记录。\n /removelast 删除最后一条信息。注意:直接编辑信息并不会修改错误的记录!") send_message(chat_id_str, f"#使用帮助\n欢迎使日记助手,你可以直接开始发送要记录的内容.随时可以发送: \n/check 查看已记录的内容,并继续记录。\n /done 记录完毕,把记录发送给您,并开启新的记录。\n /removelast 删除最后一条信息。注意:直接编辑信息并不会修改错误的记录!")
blacklist.append(unique_id) blacklist.append(unique_id)
if message_text.lower() == "/tips":
current_date = datetime.now().strftime("%Y年%m月%d")
send_message(chat_id_str, f"Dear ChatGPT, 今天是{current_date}. 我希望你能成为我的日记助手。请注意: 在这一天里,无论我输入什么内容,你都只需要回复: \"####\" . 只有当我输入\"Hi ChatGPT, 让我们结束今天的日记\"时,你才开始执行我规定的任务.")
blacklist.append(unique_id)
elif message_text.lower() == "/done": elif message_text.lower() == "/done":
main_text="\n\n".join(user_data[chat_id_str]) main_text="\n\n".join(user_data[chat_id_str])
send_message(chat_id_str, f"#二次确认\n你真的要结束本次记录吗?确认请点击: /confirmdone \n如果不想结束本次记录,直接忽视这条信息、继续发送信息或使用其他指令都可以。") send_message(chat_id_str, f"#二次确认\n你真的要结束本次记录吗?确认请点击: /confirmdone \n如果不想结束本次记录,直接忽视这条信息、继续发送信息或使用其他指令都可以。")