mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 04:37:54 +00:00
fixed context size depletion problem
This commit is contained in:
parent
10dacbbb47
commit
513770b73e
@ -812,9 +812,11 @@ class LollmsApplication(LoLLMsCom):
|
|||||||
"\n" + self.config.discussion_prompt_separator + message.sender + ": " + message.content.strip())
|
"\n" + self.config.discussion_prompt_separator + message.sender + ": " + message.content.strip())
|
||||||
|
|
||||||
# Check if adding the message will exceed the available space
|
# Check if adding the message will exceed the available space
|
||||||
if tokens_accumulated + len(message_tokenized) > available_space:
|
if tokens_accumulated + len(message_tokenized) > available_space-n_tokens:
|
||||||
message_tokenized[:-(available_space-tokens_accumulated)]
|
# Update the cumulative number of tokens
|
||||||
full_message_list.insert(0, message_tokenized)
|
msg = message_tokenized[-(available_space-tokens_accumulated-n_tokens):]
|
||||||
|
tokens_accumulated += available_space-tokens_accumulated-n_tokens
|
||||||
|
full_message_list.insert(0, msg)
|
||||||
break
|
break
|
||||||
|
|
||||||
# Add the tokenized message to the full_message_list
|
# Add the tokenized message to the full_message_list
|
||||||
|
Loading…
Reference in New Issue
Block a user