mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2025-09-04 10:20:45 +00:00
🐛 修复可能出现首条消息不为user消息导致报错的问题
This commit is contained in:
parent
c9c22a8630
commit
db9794a18a
1 changed files with 3 additions and 0 deletions
|
@ -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 :]
|
||||
|
||||
# 没有未处理的消息说明已经被处理了,跳过
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue