zhangjf commited on
Commit
28ff50c
·
1 Parent(s): df5f063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -59,7 +59,7 @@ See https://github.com/openai/openai-python/blob/main/chatml.md for information
59
 
60
  def forget_long_term(messages, max_num_tokens=500):
61
  while num_tokens_from_messages(messages)>max_num_tokens:
62
- if messages[0]["role"]=="system" and not len(messages[0]["content"]>=max_num_tokens):
63
  messages = messages[:1] + messages[2:]
64
  else:
65
  messages = messages[1:]
 
59
 
60
  def forget_long_term(messages, max_num_tokens=500):
61
  while num_tokens_from_messages(messages)>max_num_tokens:
62
+ if messages[0]["role"]=="system" and not len(messages[0]["content"])>=max_num_tokens:
63
  messages = messages[:1] + messages[2:]
64
  else:
65
  messages = messages[1:]