Fix shrink history for short path case.
This commit is contained in:
parent
b1a38d5e86
commit
536930d426
@ -156,8 +156,8 @@ class AIResponder(object):
|
||||
user_ma = re.match(user_re, message.user)
|
||||
if chan_ma and user_ma:
|
||||
self.history.append({"role": "user", "content": str(message)})
|
||||
if len(self.history) > limit:
|
||||
self.history = self.history[-limit:]
|
||||
while len(self.history) > limit:
|
||||
self.shrink_history_by_one()
|
||||
if self.history_file is not None:
|
||||
with open(self.history_file, 'wb') as fd:
|
||||
pickle.dump(self.history, fd)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user