mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
chore: optimize memory messages fetch count limit (#6021)
This commit is contained in:
parent
79df8825c8
commit
23dc6edb99
|
@ -36,9 +36,11 @@ class TokenBufferMemory:
|
||||||
).order_by(Message.created_at.desc())
|
).order_by(Message.created_at.desc())
|
||||||
|
|
||||||
if message_limit and message_limit > 0:
|
if message_limit and message_limit > 0:
|
||||||
messages = query.limit(message_limit).all()
|
message_limit = message_limit if message_limit <= 500 else 500
|
||||||
else:
|
else:
|
||||||
messages = query.all()
|
message_limit = 500
|
||||||
|
|
||||||
|
messages = query.limit(message_limit).all()
|
||||||
|
|
||||||
messages = list(reversed(messages))
|
messages = list(reversed(messages))
|
||||||
message_file_parser = MessageFileParser(
|
message_file_parser = MessageFileParser(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user