Commit 66f7408
Changed files (1)
src
history
src/history/query.py
@@ -14,7 +14,7 @@ from database.d1 import query_d1
from database.turso import turso_exec, turso_parse_resp
from history.d1 import get_d1_chatinfo, save_chatinfo_to_d1
from history.turso import get_turso_chatinfo, save_chatinfo_to_turso
-from history.utils import TURSO_KWARGS, check_save_history, filter_response, get_chat, get_user_from_chat, is_admin, keyword_query, list_chat_ids
+from history.utils import TURSO_KWARGS, filter_response, get_chat, get_user_from_chat, is_admin, keyword_query, list_chat_ids
from llm.utils import convert_html
from messages.parser import parse_chat, parse_msg
from messages.progress import modify_progress
@@ -51,17 +51,14 @@ HELP = f"""🗣**查询当前对话聊天记录**
async def query_chat_history(client: Client, message: Message, **kwargs):
- info = parse_msg(message, silent=True, use_cache=False)
- admin_call = is_admin(info["uid"])
- if not check_save_history(info["ctype"], info["cid"]) and not admin_call: # save history is disabled for this chat
- return
- if not startswith_prefix(info["text"], prefix=PREFIX.HISTORY):
+ if not startswith_prefix(message.content, prefix=PREFIX.HISTORY):
return
- if equal_prefix(info["text"], prefix=PREFIX.HISTORY):
+ if equal_prefix(message.content, prefix=PREFIX.HISTORY):
await send2tg(client, message, texts=HELP, **kwargs)
return
- if startswith_prefix(info["text"], prefix="/history") and not admin_call:
- await send2tg(client, message, texts="⚠️您无权使用此命令", **kwargs)
+ info = parse_msg(message, silent=True, use_cache=False)
+ if startswith_prefix(message.content, prefix="/history") and not is_admin(info["uid"]):
+ await send2tg(client, message, texts="⚠️您无权使用此命令, 请使用 `/hist`", **kwargs)
return
if info["text"].strip() == "/history -l":