Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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:]
|