Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fixbug: summary too long

莘权 马264799541155
diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py
index b1d8aaa4a..b2a0faca5 100644
--- a/metagpt/provider/openai_api.py
+++ b/metagpt/provider/openai_api.py
@@ -233,7 +233,8 @@ class OpenAIGPTAPI(BaseGPTAPI, RateLimiter):
if len(text) < max_token_count:
return await self._get_summary(text, max_words=max_words)
- text_windows = self.split_texts(text, window_size=max_token_count - max_words)
+ padding_size = 20 if max_token_count > 20 else 0
+ text_windows = self.split_texts(text, window_size=max_token_count - padding_size)
summaries = []
for ws in text_windows:
response = await self._get_summary(ws, max_words=max_words)