From f60d00824135ea77a4d4057ac7b9773f86e817e7 Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Mon, 15 Dec 2025 03:51:25 +0000 Subject: [PATCH] =?UTF-8?q?fix(ai=5Fchat):=20=E5=90=88=E5=B9=B6=E8=81=8A?= =?UTF-8?q?=E5=A4=A9=E9=80=BB=E8=BE=91=E4=B8=BA=E5=8D=95=E4=B8=80system?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clover_sqlite/models/chat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/clover_sqlite/models/chat.py b/src/clover_sqlite/models/chat.py index 0928bf1..d929722 100644 --- a/src/clover_sqlite/models/chat.py +++ b/src/clover_sqlite/models/chat.py @@ -210,6 +210,7 @@ class GroupChatRole(Model): role_setting = await ChatRole.get_role_setting(role_name=role_name) if role_setting: existing_record.role_name = role_name + role_setting = role_setting + "\n你现在在qq群聊聊天,回复一定要口语化(这非常重要),不要使用markdown。如果在讲解概念、题目,请详细回复(50字以上);如果是闲聊,回复严禁超出35个字。" data = [{"role": "system", "content": role_setting}] existing_record.role_chat_history = data await existing_record.save() @@ -235,11 +236,11 @@ class GroupChatRole(Model): await history.save() else: history.role_chat_history.append(content) - if len(history.role_chat_history) > 5: - history.role_chat_history.pop(2) + if len(history.role_chat_history) > 12: + history.role_chat_history.pop(1) - data = {"role": "system", "content": "你现在在qq群聊聊天,回复一定要口语化(这非常重要),不要使用markdown。如果在讲解概念、题目,请详细回复(50字以上);如果是闲聊,回复严禁超出35个字。"} - history.role_chat_history.append(data) + #data = {"role": "system", "content": "你现在在qq群聊聊天,回复一定要口语化(这非常重要),不要使用markdown。如果在讲解概念、题目,请详细回复(50字以上);如果是闲聊,回复严禁超出35个字。"} + #history.role_chat_history.append(data) print(history.role_chat_history) await history.save()