fix: remove the latest message from the user that does not have any answer yet (#9297)

pull/9270/head
kurokobo 1 year ago committed by GitHub
parent d15ba3939d
commit 857055b797
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -60,8 +60,8 @@ class TokenBufferMemory:
thread_messages = extract_thread_messages(messages)
# for newly created message, its answer is temporarily empty, we don't need to add it to memory
if thread_messages and not thread_messages[-1].answer:
thread_messages.pop()
if thread_messages and not thread_messages[0].answer:
thread_messages.pop(0)
messages = list(reversed(thread_messages))

Loading…
Cancel
Save