|
|
@ -114,13 +114,15 @@ async def get_full_prompt(simple_prompt: str, bot, chat_history): |
|
|
|
break |
|
|
|
if chat_item.message["en"].startswith('!'): |
|
|
|
continue |
|
|
|
if chat_item.message["en"].startswith('<ERROR>'): |
|
|
|
continue |
|
|
|
#if chat_item.message["en"] == bot.greeting: |
|
|
|
# continue |
|
|
|
if chat_item.num_tokens == None: |
|
|
|
chat_item.num_tokens = await num_tokens("{}: {}".format(chat_item.user_name, chat_item.message["en"])) |
|
|
|
# TODO: is it MAX_TOKENS or MAX_TOKENS - max_new_tokens?? |
|
|
|
logger.debug(f"History: " + str(chat_item) + " [" + str(chat_item.num_tokens) + "]") |
|
|
|
if total_num_tokens < (MAX_TOKENS - max_new_tokens): |
|
|
|
if total_num_tokens + chat_item.num_tokens < MAX_TOKENS - max_new_tokens: |
|
|
|
visible_history.append(chat_item) |
|
|
|
total_num_tokens += chat_item.num_tokens |
|
|
|
else: |
|
|
|