🐛 修复可能出现首条消息不为user消息导致报错的问题

This commit is contained in:
FuQuan233 2025-04-28 20:19:47 +08:00
parent c9c22a8630
commit db9794a18a

View file

@ -252,6 +252,9 @@ async def process_messages(group_id: int):
{"role": "system", "content": systemPrompt}
]
while len(state.history) > 0 and state.history[0]["role"] != "user":
state.history.popleft()
messages += list(state.history)[-plugin_config.history_size * 2 :]
# 没有未处理的消息说明已经被处理了,跳过