mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-04 18:46:36 +00:00
fix(ai_chat): 合并聊天逻辑为单一system块
This commit is contained in:
parent
d9e7cd05ec
commit
f60d008241
1 changed files with 5 additions and 4 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue