mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
Merge branch 'feature-obfuscate' into 'mgx_ops'
Feature obfuscate See merge request pub/MetaGPT!348
This commit is contained in:
commit
cb3541f204
1 changed files with 1 additions and 2 deletions
|
|
@ -300,7 +300,6 @@ class BaseLLM(ABC):
|
|||
if compress_type == CompressType.NO_COMPRESS:
|
||||
return messages
|
||||
|
||||
current_token_count = 0
|
||||
max_token = TOKEN_MAX.get(self.config.model, max_token)
|
||||
keep_token = int(max_token * threshold)
|
||||
compressed = []
|
||||
|
|
@ -318,7 +317,7 @@ class BaseLLM(ABC):
|
|||
# system_msgs = [msg for msg in messages if msg["role"] == system_msg_val]
|
||||
# user_assistant_msgs = [msg for msg in messages if msg["role"] != system_msg_val]
|
||||
compressed.extend(system_msgs)
|
||||
current_token_count += self.count_tokens(system_msgs)
|
||||
current_token_count = self.count_tokens(system_msgs)
|
||||
|
||||
if compress_type in [CompressType.POST_CUT_BY_TOKEN, CompressType.POST_CUT_BY_MSG]:
|
||||
# Under keep_token constraint, keep as many latest messages as possible
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue